It could be what either of them said, or sunburn can cause headaches, or it could be for any numerous amounts of reasons. Headaches are pretty common, add a little too much sun to the equation and well it can happen. Drink lots of water or gatorade or something that'll hydrate you and you'll be fine.
You got too much sun? It's possible you're suffering from a little heat exhaustion. Stay in the shade and drink lots of water.
You might be dehidrated, or overheating