I know that it could be related to the effects of caffeine with blood pressure, but I don't know if there are any other side effects of caffeine itself or from the other chemical components inside a cup of coffee.
Different people react to chemicals and stimulants in slightly different manners. It's entirely possible that the raise in blood pressure caused by caffeine may be exaggerated in some individuals (especially those who are caffeine naive) and cause headaches.
On the other hand, caffeine may reduce or prevent headaches in other individuals through several mechanisms:
Caffeine is also a common ingredient in many medications used for treating migraines, due to the fact that it makes analgesics work more efficiently, causes a faster absorption, and allows for a reduced dosage which decreases possible side effects of certain analgesics.
It's also possible for people who are caffeine addicted (daily coffee drinkers) to begin withdrawal symptoms if they don't get caffeine/coffee. One of these symptoms may be headache. Consuming caffeine again can alleviate these withdrawal symptoms.