I always have a headache, I have chronic intractable migraine so I do have sex during headaches. I often also get severe Breakthrough Migraines (the ones which break through with severe pain, aura, light sensitivity, nausea, body aches etc even with a wall of medicine between myself and the pain) and often I don't want to have sex then.
I few severe migraines ago, my husband started massaging my neck to relax me. He did ask if I wanted to see if sex would help the pain, I said only if we could stop if it got worse. It did get better, but I had a load of pain meds on board, and I was able to have a decent orgasm or two (or more.) I almost forgot I had a migraine. I still had it when I woke up the next morning but it had reduced by 75%. This has happened several times. The ones with the worst nausea, though, I just don't want to be touched. Chances are, if I have an ice pack on and am loaded up on meds, it's best not to touch me. I'll let him know when it's OK to have sex.