Headaches can occur for many reasons including food sensitivity, lack of physical activity, physical activity with improper form, hormones, medication, poor posture, etc.
The most common source I've seen is poor posture - specifically from people looking down at their phones and laptops all day. When we look down at our phones, the front neck muscles are compressing, and the back neck muscles are getting pulled tight. This blocks blood flow and nerve supply to the head, causing headaches.
Try this stretch routine from my eBook, Stretching for Fitness, Health, and Performance. I suggest you stretch every day for at least 15 minutes. Always stretch both sides for at least 30-60 seconds, and don't forget to breathe!