As far as we know, everything in nature (classically) follows the principle of extremal action. Meaning that a quantity, [itex]S = \int\!dt\, (T - V)[/itex] is extremized over the history of the system. Here T is kinetic energy and V is potential energy. For light, the action is usually simply equal to the time it takes to propagate from source to destination.
Quantum mechanically, to find the probability of ending up at some point, you add up every possible path, weighing each path with a phase factor of [itex]e^{i S}[/itex], and square the result. For the most part, paths interfere destructively because they all have wildly different phase factors. But for paths where [tex]S[/tex] is an extremum (minimum, maximum, saddle point), you end up with a lot of paths with the same phase factor, and these constructively interfere. So as long as quantum effects aren't too strong, the most dominant contribution to the probability comes from that path where [tex]S[/tex] is an extremum. This is simply the classical solution to the Euler-Lagrange equations of motion.
Fermat's principle played an important role in de Broglie's development of his wave theory as well as to the principle of extremal action.