It is hard to tell. Bad quality sunglasses can cause headache sometimes. But you may get headache because you are not adapt to the sunglasses that make you feel weird to wear them. So, you may get headaches the first couple of times you wear them. That does not mean the sunglasses are in bad quality. If you still headaches, try out more sunglasses. If you still can't find the right pair, you can visit an eye doctor to see what's wrong with your eyes.
Maybe you haven't got used to sunglasses, which make you often get headaches when wearing sunglasses. If you always get headaches when wearing sunglasses, maybe the sunglasses are not fitted properly. You should go back to your optician and have a re-check to see whether your sunglasses are customized for you exactly. If the sunglasses can't fit you properly, you may get headches from them.
Most people suffer from headaches at one time or another when wearing sunglasses, and many people suffer from migraines, ranging in frequency from several times a year to once a month or more often. In many cases, a migraine or severe headache forces the sufferer into isolation until it goes away, damaging their ability to work, socialize, and generally live life to its fullest.An effective pair of sunglasses should block both UVA and UVB rays, but new research suggests that High Energy Visible (HEV) light may also contribute to eye disorders, particularly in children. There is still insufficient data on this subject, but some manufacturers now design to block UV rays as well as HEV light, reducing your changes or visual damage from light sources. It's very important to note that dark glasses are not the same as UV-exclusive glasses. Check to make sure that your shades are made by a reputable manufacturer, and that they're certified to block out UVA and UVB at least, if they don't do this, it's very possible that they're worsening your exposure to harmful light by tricking your eyes into.