My husband gets a severe headache after masturbatin, but not sex what causes this?

There . There is a diagnosis called "post-coital headache" (post-sexual intercourse headache), that can occur after sex, however as it sounds like it has been persistent he should be seen by his physician and have imaging studies of his brain (ct or mri). If he has any visual changes, vomiting, weakness, or change in consciousness then he would need to be seen as an emergency.