Suppose $(X,d)$ is a compact metric space and $F:X\rar X$ a surjection such that for all $x,y\in X$: $d(F(x),F(y))\leq d(x,y)$. Then $F$ is an isometry.
1. Suppose $X$ is finite, then $F$ is a bijection; put $f:X\times X\rar X\times X$, $f(x,y)=(F(x),F(y))$, then $f$ is a bijection too. For any $\d > 0$ consider the neighborhood $N(\d)\sbe X\times X$, $$ N(\d)\colon=\{(x,y):d(x,y) < \d\}~. $$ Since $F$ is a contraction we have $f(N(\d))\sbe N(\d)$ and as $N(\d)$ is finite and $f$ a bijection we infer that $f(N(\d))=N(\d)$ and thus $f(N(\d)^c)=N(\d)^c$, i.e. for all $x,y\in X$ satisfying $d(x,y)\geq\d$ we also have $d(F(x),F(y))\geq\d$. Now for any pair $(x,y)$ we put $\d=d(x,y)$ and conclude that $(x,y)\in N(\d)^c$ and therefore $f(x,y)\in N(\d)^c$, i.e. $d(F(x),F(y))\geq d(x,y)$.
2. In the general case choose a minimal $\e$-net $S$ and consider $$ N(S,\d)\colon=\{(x,y)\in S\times S:\,d(x,y) < \d\}~. $$ Then $F(S)$ is again an $\e$-net and since $|F(S)|\leq|S|$ we get by minimality: $|F(S)|=|S|$, in particular $F:S\rar F(S)$ is a bijection and thus $f:S\times S\rar F(S)\times F(S)$ is a bijection. Moreover, as above $f(N(S,\d))\sbe N(F(S),\d)$. Now we choose the minimal $\e$-net $S$ such that the cardinality of $N(S,\d)$ be maximal among all minimal $\e$-nets; this condition implies that $$ f(N(S,\d))=N(F(S),\d) $$ and since $f:S\times S\rar F(S)\times F(S)$ is a bijection: $$ f((S\times S)\sm N(S,\d)) =(F(S)\times F(S))\sm N(F(S),\d) $$ i.e. for all $x,y\in S$ satisfying $d(x,y)\geq\d$ we have: $d(F(x),F(y))\geq\d$.
Finally, as $S$ is an $\e$-net and $F$ a contraction, we find for any pair $(a,b)\in X\times X$ a pair $(x,y)\in S\times S$ such that $d(x,a),d(y,b) < \e$ and $d(F(x),F(a)),d(F(y),F(b)) < \e$. Hence, putting $\d\colon=d(x,y)$: $$ d(F(a),F(b)) > d(F(x),F(y))-2\e \geq d(x,y)-2\e > d(a,b)-4\e ~. $$ This solution is essentially taken from Isometries in compact metric spaces. This generalizes to arbitrary compact spaces $X$ as follows: Suppose $F:X\rar X$ is onto and ${\cal N}$ is a neighborhood basis such that for all $N\in{\cal N}$: $f(N)\sbe N$. Then $F$ is a homeomorphism and for all $N\in{\cal N}$ we have: $f(N^c)=N^c$ (equivalently: $f(N)=N$).