The frequency of the wave remains constant when the wave is travelling from one medium to another.
Velocity of the wave = frequency x wavelength
From here, we know that velocity of wave changes and frequency doesn't. Hence the wavelength should change for the equation to be true. It is this change that causes refraction of light.
As the wave is traveling from a rarer medium to a denser medium.
Velocity of the light decreases, frequency remains same and hence wavelength decreases