Sex does not cause headaches, but it can be caused by a variety of reasons, such as poor rest, tension-induced headaches. Headaches can also be caused by illnesses, such as high blood pressure, insufficient blood supply to the brain, cerebral vascular malformations, cerebral thrombosis and so on. Acute infections such as colds or pneumonia can cause headaches. Also cervical spondylosis can trigger head and neck pain. Having had a traumatic injury can also cause headaches. All in all, having sex has nothing to do with headaches. It is recommended to go to the hospital to check the head MRI and so on, according to the situation for further treatment.