early 15c., in Macabrees daunce, daunce of Machabree, a kind of morality show or allegorical representation of death and his victims, from Old French (danse) Macabré "(dance) of Death" (1376), which is of uncertain origin.
John Lydgate (c. 1370–c. 1451), the monk/poet who first translated it into English, seems to have regarded it as the name of the French author, and perhaps it was a French surname Macabré. Or perhaps it is from Medieval Latin (Chorea) Machabæorum, literally "dance of the Maccabees" (leaders of the Jewish revolt against Syro-Hellenes; see Maccabees). If so, the association with the dance of death (a favorite subject of literature and art in the Middle Ages) would be from vivid descriptions of the martyrdom of the Maccabees in the Apocryphal books.
The typical form which the allegory takes is that of a series of pictures, sculptured or painted, in which Death appears, either as a dancing skeleton or as a shrunken corpse wrapped in grave-clothes to persons representing every age and condition of life, and leads them all in a dance to the grave. [Encyclopaedia Britannica, 11th ed., 1911]
The abstracted sense of "characterized by gruesomeness" is attested 1842 in French, by 1889 in English. Related: Macaberesque.
1961, "comedy that deals in themes and subjects usually regarded as serious or taboo," from black (adj.), in a figurative sense of "morbid," + comedy. Compare French pièce noire, also comédie noire "macabre or farcical rendering of a violent or tragic theme" (1958, perhaps the inspiration for the English term) and 19th-century gallows-humor. In a racial sense, from 1921.