Motivation
Its a classic set up. Take a metric space $M$, with distance function $d:M\times M\to \mathbb{R}$. The set of isometries of $M$ is the set of functions $f: M \to M$ which preserve distance. This set has much of the structure of a group without additional assumptions; the composition of two isometries gives an isometry, the identity function takes the place of the identity, etc.
Although every isometry must be injective, however, it is not necessarily a bijection, and so might not have an inverse. For example any injective function from a metric space with the discrete metric ($d:M\times M\to \mathbb{R}, d(a,b) = 1$ if $a \neq b$ and $0$ if $a=b$) to itself is an isometry.
As the group of isometries is quite a useful gadget we can get round this. For example in MathWorld an isometry is assumed to be bijective: http://mathworld.wolfram.com/Isometry.html
Yet in Euclidean space, we do not need any additional assumption:
Lemma
Every isometry of $\mathbb{E}^2$, the Euclidean plane, is a surjection.
ProofOn the plane, for example, assume that a point $a$ does not lie in the image of an isometry $T$. Take three distinct points $T(b_1), T(b_2)$ and $T(b_3)$ that do lie in the image (as $T$ is injective they have a unique preimage). Let $d_i = d(b_i,a)$ be the distance between $d$ and $b_i$.
The three circles radius $d_i$ around $T(b_i)$, intersect together only at $a$, as the distances between the $T(b_i)$ and the $B_i$ are the same, the circles radius $d_i$ around $b_i$ will also intersect at a unique point $a'$. The point $T(a')$ must be $a$ as that is the only point that satisfies all the point to point distances, so $a$ does lie in the image of $T$.
$\square$
Question
We can extend this argument to higher dimensional Euclidean spaces, yet it uses non-trivial properties, in particular how circles intersect. Is there a simple propetry of a metric space that ensures that the set of isometries forms a group?
Edit To rather strengthen the question, are there simple properties that are necessary and sufficient.