It is with the principle of Least action that the law of refraction works - which implies that light has to minimize the time taken to travel in the medium. To my knowledge I think this effectively done by altering the wavelength rather than frequency since the frequency of light would have to be the inverse of time taken for light to travel a distance of wavelength.
About the conservation of energy I am not sure,
the conservation of energy (E = hv) - its not just v(freq) can remain constant; it can also be given by E=hc/λ but since c changes the value of λ also has to change to keep E constant. But again you might have to reason why c changes.