Some women do have sudden severe headaches precipitated by sexual activity, and often at the time of orgasm. They’re called benign orgasmic headaches, and they seem to be caused by a reversible cerebral artery spasm. While they’re not life-threatening in any way, they certainly can be a disincentive to having sex!
A beta-blocker taken before sexual activity is likely to prevent the attacks. This is the class of medications often used to treat hypertension or to prevent migraine headaches. Talk to your primary care provider about a prescription. This treatment works very well for most women, and has few if any side effects.