Because the speed of light,
\[c\]
  the frequency  \[f\]
  and the wavelength  \[\lambda\]
  are related by the equation  \[c = f \lambda\]
  it might be throught that the frequency and wavelength both change but this is not the case.In air the speed is
\[c\]
  , the frequency is  \[f\]
  and the wavelength is  \[ \lambda\]
In medium 1 with refractive index
\[n_1\]
  the speed is  \[\frac{c}{n_1}\]
  , the frequency is  \[f\]
  and the wavelength is  \[\frac{ \lambda}{n_1}\]
The wave equation
\[c=f \lambda\]
  becomes  \[\frac{c}{n_1}=f \frac{\lambda}{n_1}\]
  We can muliply by
\[n_1\]
  on both sides to get   \[c = f \lambda\]
If the light then travels through medium 2 with refractive index
\[n_2\]
  the speed is  \[\frac{c}{n_2}\]
  , the frequency is  \[f\]
  and the wavelength is  \[\frac{ \lambda}{n_2}\]
The wave equation
\[c=f \lambda\]
  becomes  \[\frac{c}{n_2}=f \frac{\lambda}{n_2}\]
  We can muliply by
\[n_2\]
  on both sides to get   \[c = f \lambda\]