There is an improvement of the answer of Joseph Van Name which I feel is much more in the spirit in the question asked:
Let $(X,d)$ be a compact metric space, and assume that the mapping $f\colon X\to X$ does not decrease distances, that is $d(f(x),f(y))\ge d(x,y)$ for all $x,y\in X$. Then $f$ is a bijection.
Sketch of a proof. The proof I came up with long ago consists of two lemmas.
Lemma 1. A mapping $f$ as above must be an isometry.
Proof. Let $(x,y)\in X\times X$, and consider the sequence $(f^k(x),f^k(y))$. Since $X$ is compact, there is a convergent subsequence $\{(f^{k_i}(x),f^{k_i}(y))\}$. In particular, the sequence $\{f^{k_i}(x)\}$ is convergent, which implies that $\lim_{j>i\to\infty}d(f^{k_i}(x),f^{k_j}(x))=0$, and hence (since $f$ does not decrease distances) $\lim_{j>i\to\infty}d(x,f^{k_j-k_i}(x))=0$. The same is true for the sequence of the second coordinates. Thus, $(x,y)$ is a limit point of the sequence $\{(f^k(x),f^k(y))\}$. Suppose that $d(f(x),f(y))>d(x,y)$ for some $x,y\in X$. Then $d(f(x),f(y))-d(x,y)>\epsilon$ for some $\epsilon>0$. Then
$d(f^n(x),f^n(y))-d(x,y)>\epsilon$ for all $n$, which is a contradiction.
Lemma 2. An isometry of a compact metric space is a bijection.
Proof. Let $x\in X$. Let us consider the sequence $\{f^n(x)\}$. This sequence has a a convergent subsequence $\{f^{k_i}(x)\}$. This implies that $\lim_{j>i\to\infty}d(f^{k_i}(x),f^{k_j}(x))=0$, and hence (since $f$ is an isometry) $\lim_{j>i\to\infty}d(x,f^{k_j-k_i}(x))=0$. Thus, $x$ is a limit point of the sequence $\{(f^{k_j-k_i}(x)\}$, in particular $x$ is a limit point of $f(X)$. But an isometry is continuous, and the image of a compact space under a continuous map is a compact, thus $x\in f(X)$, so $f$ is surjective. Since $f$ is manifestly injective, the statement is proved.