In the NovelsEdit
It is believed that they are worn to protect the citizens' eyes from being damaged by the bright green wonder of the Emerald City. This is most likely linked to the Wizard of Oz storyline in which citizens are forced to wear the glasses to make them believe that the city is emerald green, a trick brought about by the Wizard.
In the MusicalEdit
Like the novel and the 1939 film, the city is actually green, and the glasses are made quite superfluous, being completely absent from The Wizard of Oz.