When you exercise, or exert yourself physically, the muscles of the head, neck, and scalp need more blood to circulate. This causes the blood vessels to swell, which can lead to a condition called exertional headaches.
Headaches that most frequently occur due to exercise or over-exertion include jogger's headache and orgasmic headache (sex headache). While these may occur in isolation, they are most common in people who have an inherited susceptibility to migraine (one or both parents have migraines).
It has been found that most exertional headaches are benign and respond to usual headache treatments. Some exertional headaches are particularly responsive to Indocin (indomethacin), an anti-inflammatory drug available with a doctor's prescription. Still, in order to rule out other medical causes -- some of which can be life-threatening -- a doctor should evaluate your headaches.