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 dilate, 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. It's very important, though, not to assume that your headaches, especially new exertional headaches, are caused by exercise. In order to rule out other medical causes -- some of which can be life-threatening -- a doctor needs to evaluate your headaches.
Some exertional headaches are particularly responsive to Indocin (indomethacin), an anti-inflammatory drug available with a doctor's prescription, taken 30 to 60 minutes before exercise.