There are a couple of possibilities.
Coughing can raise the pressure inside your head, which can cause pain sometimes. There is also a poorly-understood entity called the "primary cough headache
, " that is associated with coughing, straining, laughing, crying
, etc. Here's an interesting link on the topic. http://www.mayoclinic.com/health/primary-cough-headaches/ds00639.
Answer assisted by David Miller, Medical Student