When water vapour from the air condenses on a cold glass surface, such as one's eye glasses, you'll end up with droplets of water. These droplets are commonly known as fog. And with fog, comes distorted vision.
There are two ways foggy glasses can be solved. You can either heat up the surface, as is done for bathroom mirrors in some pricier hotels, or you can prevent the condensed water from forming droplets. How is this done? Well, by lowering the water's surface tension; or in other words, the force with which H2O molecules are attracted to one other. This attraction - or surface tension - is what causes fog to appear in the first place, since the water molecules are more attracted to each other than they are to the cold surface. The idea then is to introduce some substance that gets in between the water molecules so as to prevent droplets from forming and instead allow the water to spread evenly across the surface thereby keeping vision intact. Several substances can work to produce this effect, such as rubbing alcohol (isopropanol), which is the most common, as well as a variety of other detergents.
Hope this makes you see the science more clearly.