I want to know what lead to the notion of covering spaces, and the evolution of the concept. I understand that topology was not developed to solve problems, but to gain insight into the foundation of mathematics. So, what insight lead to the development of covering spaces?
You wrote "topology was not developed to [solve?] problems but to gain insight to foundations of mathematics". This is completely wrong, and the notion of covering is a good example.
Klein describes in his memoirs how he discovered what is now called the Uniformization theorem. (This is a very concrete statement from the theory of analytic functions). Then he wrote to Schwarz and Poincaré. Then Schwarz proposed the notion of covering, in particular the universal covering. So it was invented in the attempts to solve a concrete problem. The story is described in detail in this paper:
William Abikoff, The uniformization theorem. Amer. Math. Monthly 88 (1981), no. 8, 574–592.
Later, the research of the uniformization theory led to the rigorous dimension theory, one of the earliest deep results of topology (Brouwer).
Similarly, one of the first results of topology, classification of compact surfaces, comes from Riemann's theory of algebraic functions and Abelian integrals. (Riemann visited Italy where he met Betti, and made him interested in topology.)
Finally, the "founding father" of modern topology (Poincaré) was clearly stimulated by concrete problems of differential equations and by uniformization theory.
None of the founders of topology (Riemann, Betti, Möbius, Schwarz, Brouwer) was thinking of it as a "foundation of mathematics". All were solving concrete, specific problems of analysis.