A light ray is refracted (bent) when it passes from one medium to another at an angle and its speed changes. At the interface, it is bent in one direction if the material it enters is denser (when light slows down) and in the OTHER direction if the material is less dense (when light speeds up). The dispersion occurs in prism but not in glass slab because of the geometric design. In a slab, the opposite sides are parallel to each other whereas, in the case of the prism, the sides are not parallel to each other. The dispersion of light does occur in a rectangular glass slab during the first interface of air and glass slab. They travel a very small distance in the glass slab to meet the second interface.