Answer
The refracted wave must obey Snell's equation
Ni sin θi = Nr sin θr
If Nr differs from Ni then sin θr will differ from sin θi
If the wave originates from point A and ends at point B then Snell's Law shows that the time for light to get from point A to point B is a minimum.