From the information you give me, it is hard to determine exactly what is going on your eyes. I can't determine that new eyeglasses cause sore eyes, but i can't definite told it's not new eyeglasses cause sore eyes. Commonly, people wearing new eyeglasses may suffer some eye problems or vision problems such as blurry vision, itchy eyes, eye pain even dizziness etc. And this is a sign that the eyeglasses lenses doesn't fit for you. However, there are still many other factors that may cause sore eyes such as Conjunctivitis or eye damages etc. So, you'd better provide more information or just consult a doctor so as to treat it.
Well, according to your description, it is very likely that you may get wrong prescription. You need to go to a local optical store to have your prescription tested again as well as your new glasses. By the way, you need to stop wearing your new glasses from now on until you find the reasons or your vision will worsen. However, besides a headache, do you have any other symptoms such as blurred vision and anything else? As you know, some people will get a headache when wearing their new glasses for the first time because they need time to adjust to them. But in a few days, things will get much better.