The least action principle conceptually emerged from the least time principle for light. Light refracts along the path that gets it from the starting to the ending point the quickest, and the index of refraction is what regulates its speed. The question went like this: we know that potential and kinetic energy work together to regulate the speed of moving objects. Is there a way to combine the two quantities into something like an index of refraction? The analogy between potential fields and optics isn't just conceptual - beams of charged particles are focused using electromagnetic "lenses," made out of fields.
Do you know any references that discuss this in detail? I'm interested in the history of these developments. Who noticed this? Who asked this question?