There are 100s of causes for headache and few of them relate to the eye.
Uncorrected refractive errors, Improperly corrected refractive errors, Mis-aligned spectacles, High eye pressure, Vergence and fusional Muscle - imbalance are common eye causes for headache which as correctable.
Also, eye examination lends to identification of a dangerous cause of headache- increased brain pressure which can be fatal.