The monster wasn’t always under the bed. Or in the closet, or the wardrobe. Historical literature has a vast array of accounts of people, sometimes old but mostly very young children, scared of the things that breathed in the darkness or threatened to snatch them up. The syntax of where, exactly, the monster would be shifted according to the context of daily life – and sleeping accommodations and habits shifted over time.
So while it would be a bit reductive to say “you can’t have a monster under the bed if you don’t have a bed,” there’s a certain degree of truth to the historical fact that the now-popular image of a single child alone at night in their own bed in their own room wasn’t exactly the historical norm.
This is a subject more often studied in psychology than history, classified under nightmares or night terrors, and subject to self-help books like Monsters Under the Bed and Other Childhood Fears by Stephen W. Garber, Marianne Daniels Garber, and Robyn Freedman Spizman. The nature of the individual “monsters” tends to be vague and idiosyncratic. When H. P. Lovecraft described his personal bogies as a child, he wrote:
When I was 6 or 7 I used to be tormented constantly with a peculiar type of recurrent nightmare in which a monstrous race of entities (called by my “Night-Gaunts”—I don’t know where I got hold of the name) used to snatch me up by the stomach (bad digestion?) and carry me off through infinite leagues of black air over the towers of dead and horrible cities. They would finally get me into a grey void where I could see the needlelike pinnacles of enormous mountains miles below. Then they would let drop—and as I gained momentum in my Icarus-like plunge I would start awake in such panic that I hated to think of sleeping again. The “night-gaunts” were black, lean, rubbery things with bared, barbed tails, bat-wings, and no faces at all. Undoubtedly I derived the image from the jumbled memory of Doré’s drawings (largely the illustrations to Paradise Lost) which fascinated me in waking hours. They had no voices, and their only form of real torture was their habit of tickling my stomach (digestion again0 before snatching me up and swooping away with me. I sometimes had the vague notion that they lived in the black burrows honeycombing the pinnacle of some incredibly high mountain somewhere. they seemed to come in flocks of 25 or 50, and would sometimes fling me one to the other. Night after night I dreamed the same horror with only minor variants—but I never struck those hideous mountain peaks before waking. If I had…well, the point is that these things decreased rapidly as I grew older. Each year I believed less and less of the supernatural, and when I was 8 I began to be interested in science and cast off my last shred of religious and other superstitious belief. I do not recall many “night-gaunt” dreams after I was 8—or any after I was 10 or 11. But Yuggoth, what an impression they made on me! 34 years later I chose them as the theme of one of my Fungi…. (H. P. Lovecraft to Virgil Finlay, 24 Oct 1936, Selected Letters 5.335).
Young Lovecraft was also afraid of the dark, but his grandfather cured him of that.
Judging by newspaper accounts, general awareness of “monsters under the bed” or in the closet increased in the early 20th century; the developing field of child psychology probably helped considerably, but by about mid-century you start to see a lot more standardization of the idea of monsters—usually very atypical monsters, that is not the standard vampires or werewolves but usually much more poorly defined critters—in closets and under beds.
I wish I could point to an ultimate ur-example of monsters under the bed or in the closet, but I suspect there isn’t one; in ancient Egypt you might have a charm to Bes to protect children from night terrors, for example, but we don’t have a lot of specifics on the actual terrors themselves.
The specifics of the popular depiction of such monsters, however, actually comes together very strongly in the late 20th century. This is apparent in work like the cartoons of Gahan Wilson and Berkeley Breathed (Binkley’s Closet of Anxieties becoming a running gag throughout the course of Bloom County), and films like Monster in the Closet (1986) and Little Monsters (1989), cartoons such as Aaahh!!! Real Monsters (1994-1997), and finally the whole Monsters, Inc. franchise starting in 2001.
Monsters under the bed in these works go from individual, unique entities to part of a society; their purpose becomes less to eat kids than to quite literally prey on their fears, we get whole imaginary cultures of monsters whose lives rotate around scaring children.
Which has its own psychology at play: in the light of day, and especially to adults, many of these monsters cease to be scary. Monsters, Inc. doubles down on the goofy, but you can already see this at play in Bloom County as the “Closet of Anxieties” deals with more adult fears like politics and the threat of nuclear annihilation than it does with getting gobbled up.
It’s not clear how much the depiction of folkloric sleep monsters like the Sandman owe to night terrors or serve as a model for monsters under the bed or in the closet; contemporary popular depictions don’t draw very strongly on the idea, although Neil Gaiman gave his own eponymous Sandman in the DC Vertigo comics (1989-1996) plenty of nightmarish creations, such as the Corinthian.