Dismal began as a noun for a calendar date. It was a day on which you were advised not to do anything important.
Medieval calendars marked two unlucky days in every month, 24 in a year. These were the dies mali, Medieval Latin for "evil days." They were also called dies Aegyptiaci, the Egyptian days. Medieval writers credited the list to Egyptian astrologers, who were regarded as authorities on such matters. Some explanations tied the dates to disasters that struck Egypt, such as the biblical plagues. Etymonline says the calendars were "supposedly" based on the Egyptians' calculations. The rule was simple: begin no project on those days, and doctors were warned against bloodletting.
The phrase passed into French. Etymonline gives Anglo-French dismal in the mid-13th century, possibly from Old French (li) dis mals, "the bad days." English picked it up soon after. Etymonline records "in the dismal," meaning in times of misfortune, around 1300. The adjective appears about 1400 in "dismal day," meaning an unlucky or inauspicious one.
The word then drifted from bad luck toward bad mood. By the 1580s it meant gloomy, dreary and cheerless, and it could describe a landscape, a sound, or anything that depressed the spirits. In 1763 the name was applied to swampy land with dead trees on the coast of North Carolina.
The best-known use came in 1849, when Thomas Carlyle called economics "the dismal science." He did so in an essay attacking economists who backed the emancipation of slaves. The phrase is often wrongly said to refer to Malthus and his gloomy population forecasts, according to the Library of Economics and Liberty.
The Latin pieces are ordinary. Dies is "day," from a Proto-Indo-European root meaning "to shine," and malus is "bad." The plain calendar story fits both the dates and the sense, so no more exotic explanation is needed.