Light as a Particle
The photons in the beam of light are continuously being absorbed and re-emitted by the glass atoms (though this is also true in the other mediums light slows in). The level by which the light is slowed is dependent on how often this happens. As @garyp commented below this question, the delay also depends on how long the photon stays in the atom.
Light then speeds back up again as it is no longer absorbed and re-emitted as much (in air) or speeds all the way to the speed of light in a vacuum where there are no atoms to absorb and re-emit the photons.
Light as a Wave
Keeping in mind the particle explanation, first, the velocity of a wave in a solid is lower than the velocity of a wave in air. The second thing to keep in mind is what happens to the wave's phase as the photons get absorbed and re-emitted.
Depending on the natural frequency of the atom and the frequency of the wave, the emitted photons will change phase when compared to the other, unaffected photons. Therefore, it either falls backward or forward a bit. Since this happens every time the wave hits an atom and there are many atoms in even the smallest piece of material, this has the affect of slowing the wavefront as the wave advances through the substance.
It should also be added that light's speed doesn't slow down, rather, it is the interactions that slow it down. An analogy of this would be a car going 70 miles per hour on a highway with no other cars around, and then entering a congested area still going 70, but crashing into cars on the way through. (Obviously this isn't a perfect analogy, but it does give you an idea.)
More information is available here about this in terms of light as a particle. More information is available here in terms of light as a wave.
Hope this helps!