Yes, it's possible. The light is dispersed by the denser medium.
On entering a denser medium light will change direction bending towards the normal. Different frequencies of light (red & blue) are refracted or bent by slightly different amounts, thus splitting the white light that entered, or dispersing it into a 'rainbow' spectrum.
Exactly the same process takes place in a prism (or a raindrop, but multiple internal reflections enhance the effect here.)