Glasses were a form of eyewear, an early way of correcting vision for those with eye problems. They were replaced by either corrective laser surgery, or special kinds of drugs and treatments developed through the study of medicine.
Glasses were worn by some in the 23rd century. A transporter assistant serving aboard the USS Enterprise in 2254 wore glasses while working at the transporter console. (TOS: "The Cage", "The Menagerie, Part I", "The Menagerie, Part II")
Captain James T. Kirk was allergic to Retinax V, the conventional pharmaceutical method of correcting vision, so Dr. Leonard McCoy provided him with a pair of 18th century glasses. However, the glasses broke during the conflict with Khan Noonien Singh and his followers. (Star Trek II: The Wrath of Khan) Kirk would end up selling the glasses at an antique shop on 20th century Earth in exchange for currency needed to accomplish their mission to save Earth in the future. When Spock expressed his surprise that Kirk would sell a gift from a friend, Kirk assured him that somehow he'd still wind up with them anyway. (Star Trek IV: The Voyage Home)
In 2368, several artifacts were recovered from a cavern underneath the Earth city of San Francisco. Among them was a pair of glasses which lieutenant commander Data described as a "bifocal visual aid." (TNG: "Time's Arrow")