Roman Emperors uses emeralds to watch gladiator fights. In 12th Century China smoky quartz was used to hide the eyes and facial expressions of judges in Chinese courts. But it wasn't until the early 1900's that fashionable sunglasses as we know them became more common place.
This was especially true amongst silent film stars that constantly had red eyes due to the powerful lighting needed for the extremely slow film stock used to make those films. If the stars do it so does the rest of the world so even when the harsh lighting used in films was improved with ultra-violet filters the sunglasses remained. And they've been cool ever since.
Audrey Hepburn and Grace Kelly made wearing sunglasses in the 50's a classic accessory. Not just for sun protection but now a style necessity.