What's the motivation behind metric spaces? So a metric space is a collection of points together with operations, and where we can determine the distance between any of these points. And it must satisfy 4 axioms which are:


*

*For all x in that metric space, the distance between x and x is 0.

*For all x,y in that metric space, the distance between x and y is the same as the distance between y and x.

*For all distinct x,y in that metric space, the distance between x and y is strictly positive.

*For any x, y, z in that metric space, the distance between x and z is less than or equal to the distance between x and y + the distance between y and z. (the triangle inequality)


But what is the motivation behind defining such abstract spaces?
 A: You may have been introduced   in your analysis class to the notion of convergence, but only about the convergence of real sequences. If we want to extend this idea for say vectors, complex numbers, functions, or even sequences of sequences, and to generalize it, we can define for every mathematical object the meaning of convergence. But as you may guess, this isn't very efficient and will quickly get tedious. The other choice is to get more abstract and define  a space (which is like a set) that contain all of these objects, and to define convergence there. But since distance is important for convergence, we must be able in this space to determine distances between its points. And ladies and gentlemen, two classes of spaces fit our requirements, the first is the so-called metric spaces, and a more general class of spaces which are called  topological spaces.
A: Metric spaces were introduced by Frechet in his PhD dissertation on functional analysis, in 1906. Functional analysis (and rigorous modern analysis) was still quite new at the time. Also, an abstract, axiomatic, approach to mathematics was also not yet as routine as it is for us today. The mathematicians of that time were studying various spaces (mainly spaces of functions) and they had various notions of convergence in such spaces. But everything was ad-hoc. For each space its own notion(s) of convergence was introduced, and studied. Of course, similarities were noticed (i.e., uniqueness of limits was a common trend etc.). There was a dire need to simplify things and unify arguments. Frechet's genius was to do just that by axiomatizing the notion of distance and show that many of these spaces were instances of metric spaces. Then, by proving one result axiomatically from the metric axioms, it automatically holds for all instances. 
This was the historical motivation. In the modern view, the concept of a metric space is just an axiomatization of the notion of distance. It is among the more straightforward axiomatizations, especially to modern students who see axiomatic systems early on. The notion of distance is very important since, for instance, it is used in the definition of limit. Many geometric notions rely on a notion of distance (e.g., circles). So, it is natural to distill some common properties of distances in various contexts and set them as axioms. Voila - metric spaces. 
Just as a side note: There is quite a lot of flexibility in the axioms of metric space. Neglecting any of them (giving rise to things like semimetric, quasimetric spaces etc.) give interesting spaces as well with somewhat similar theory as metric spaces exhibit. One crucial difference though is that if the symmetry axiom is neglected (quasimetric spaces then), then the general theory is quite difference (in particular, there are then many different completions). 
