People suffering a migraine attack are sensitive to light, which intensifies the experience of the pain, and prefer to be in a darkened room until the attack is over.
(A bit like loud noise if you have a headache or a hangover.)
So - when you're not feeling well, you want to lie down - you head for bed. With a migraine, they go to a room where they can draw the curtains and have all the lights off - they 'head for a darkened room'.
(This takes a little literary licence, since 'to head for' seems to imply 'a darkened room' is there, all ready prepared, as if routinely found in a home along with a kitchen, lounge and bathroom..."That's the master bedroom, and next to it is the darkened room, and then the upstairs toilet..." It is any quiet room in the house then made as dark as possible until the migraine goes.)