Sudden severe burst occurring before or during orgasm, lasting 15 to 20 minutes, is known as orgasmic headache, and, is one of three different subtypes of sexual headache.
This type of headache is most of the time of benign nature.

Next time, before participating in any kind of sexual activities, try to take Indomethacin, nonsteroidal anti-inflammatory medication, to prevent the headache.