When it rains outside and we are driving our car, we see that the windows get foggy. Why does it happen?
When it rains the humidity (water) content of air is high. If your glasses are colder than the surrounding humid air, water will condense on them causing the 'fogging'. Given enough time the glasses will warm up and the condensed water will re-evaporate (for safety reasons it's obviously better to manually remove the condensation).