The meaning shifted mid-16c. from the incubus to the suffocating sensation it causes. Sense of “any bad dream” is recorded by 1829; that of “very distressing experience” is from 1831. Cognate with Middle Dutch nachtmare, German Nachtmahr. An Old English word for it was niht-genga.