Light has a characteristic speed at which it travels through a given medium, and it never goes faster or slower than that. In empty space, light travels at 2.9979 x 10^8 meters per second. Never faster. Never slower. In glass, light also has a characteristic speed, which is less than the speed of light in empty space. When the light exits the glass and goes back into space, the speed goes back to 2.9979 x 10^8 m/s. If it didn't, it wouldn't be light.
This may seem counterintuitive if you think of light as like a baseball flying through space. If the baseball hits a region of cotton fluff, it will slow down. When it exits the fluff and goes back into space, it will remain slow. It won't speed up, because the cotton fluff has taken away some of the ball's kinetic energy, and we all know that baseballs don't suddenly speed up for no reason.
A better analogy may be to think of light as a "disturbance in the force", to use Star Wars terminology. This disturbance, or "wave", has a certain wave speed depending on what medium it's travelling in.
You've probably heard of "photons". They are quantized particles of light. Or quantized bits of "disturbed force". If you think of these particles as being like little baseballs, then you're back to the same confusion as before. The hard part for our classical human intuition to understand is that these photons, like all quantum particles, also have a wavelike nature.
In the case of photons, their kinetic energy is inversely proportional to their wavelength. A photon of blue light has more kinetic energy than a photon of red light. When a photon of blue light passes through a plate of glass and comes out the other side, it is still blue. And when a photon of red light passes through a plate of glass and comes out the other side, it is still red. In other words, the photon has the same kinetic energy coming out of the glass as it had going into the glass.
Unlike a baseball which loses kinetic energy to a region of cotton fluff, a photon doesn't lose any kinetic energy to the glass. Yes, the photon slows down, but this isn't due to energy loss. It's just that the wave travels slower in the denser medium, but keeps the same energy.
I hope this clears things up somewhat. Light has many mysterious and wonderful properties, and this just one of them.
making a small donation to science.ca.