You can simply get rid of a headache by taking over the counter painkillers. A quick dose of ibuprofen or aspirin can take the edge off. You can also drink plenty of water and find a dark, quiet place to rest.
Well, here is a situation answer. If you have been a caffeine drinker(this happens to my grandfather) and currently stopped drinking it, this could be your problem. Think of it as caffeine withdrawal. This answer is only if you've stopped drinking caffeine. So it might not be so helpful.