This type of headache, experienced during or after the sexual activity, is known as sexual or coital headache.
In most of the cases is harmless condition, and is believed to result from muscle contraction, and/or blood vessel dilation (widening), in the head and neck during sex.
It can last minutes or hours after the sexual activity.
Usually, it appears few times (3-4 times) and disappears on its own (you may try some anti inflammatory drug like indomethacin taken an hour or two before sexual activity).
If you notice that is getting more severe with every new appearance and more frequent, you should consult your physician cause this may indicate brain blood vessels rupture and bleeding.