Wikipedia to the rescue!
To quote: nightmares were widely considered to be the work of demons and more specifically incubi, which were thought to sit on the chests of sleepers. In Old English the name for these beings was mare or mære (from a proto-Germanic *marōn, related to Old High German, in modern german it would become “Nachtmar”, and Old Norse mara), hence comes the mare part in nightmare. Etymologically cognate with Anglo-Saxon /mara/ (‘incubus’) may be Hellenic /Marōn/ (in the Odusseid) and Samskṛta /Māra/ (supernatural antagonist of the Buddha).