This is true but not very easy to prove.
Suppose $X$ is not compact. Without loss of generality assume that the
original metric $d$ on $X$ is such that $d(x,y)<1$ for all $x,y\in X.$ There
exists a decreasing sequence of non-empty closed sets $\{C_{n}\}$ whose
intersection is empty. Let $$\rho (x,y)=\sum_{n=1}^{\infty }\frac{1}{%
2^{n}}d_{n}(x,y)$$ where $$d_{n}(x,y)=\left\vert
d(x,C_{n})-d(y,C_{n})\right\vert +\min \{d(x,C_{n}),d(y,C_{n})\}d(x,y).$$ We
claim that $\rho $ is a metric on $X$ which is equivalent to $d$ and that $%
(X,\rho )$ is not complete. Note that $d_{n}(x,y)\leq 2$ for all $x,y\in X.$
If $x$ and $y$ $\in C_{k}$ then $x$ and $y$ $\in C_{n}$ for $1\leq n\leq k$
and hence $\rho (x,y)\leq \sum_{n=k+1}^{\infty }\frac{2}{2^{n}}=%
\frac{1}{2^{k}}$. Thus, the diameter of $C_{k}$ in $(X,\rho )$ does not
exceed $\frac{1}{2^{k}}$. Once we prove that $\rho $ is a metric equivalent
to $d$ it follows that $\rho $ is not complete because $\{C_{n}\}$ is a
decreasing sequence of non-empty closed sets whose intersection is empty.
Assuming (for the time being) that $d_{n}$ satisfies triangle inequality it
follows easily that $\rho $ is a metric: if $\rho (x,y)=0$ then $%
d(x,C_{n})=d(y,C_{n})$ for each $n$ and $\min
\{d(x,C_{n}),d(y,C_{n})\}d(x,y)=0$ for each $n$. If $d(x,y)\neq 0$ it
follows that $d(x,C_{n})=d(y,C_{n})=0$ for each $n$ which implies that $x$
and $y$ belong to each $C_{n}$ contradicting the hypothesis. Thus $\rho $\
is a metric. Also $\rho (x_{j},x)\rightarrow 0$ as $j\rightarrow \infty $
implies $\left\vert d(x_{j},C_{n})-d(x,C_{n})\right\vert \rightarrow 0$ and $%
\min \{d(x_{j},C_{n}),d(x,C_{n})\}d(x_{j},x)\rightarrow 0$ as $j\rightarrow
\infty $ for each $n$. There is at least one integer $k$ such that $x\notin
C_{k}$ and we conclude that $d(x_{j},x)\rightarrow 0$. Conversely, suppose $%
d(x_{j},x)\rightarrow 0$. Then $d_{n}(x_{j},x)\rightarrow 0$ for each $n$
and the series defining $\rho $ is uniformly convergent, so $\rho
(x_{j},x)\rightarrow 0$. It remains only to show that $d_{n}$ satisfies
triangle inequality for each $n$ . We have to show that $$\left\vert
d(x,C_{n})-d(y,C_{n})\right\vert$$ $$+\min \{d(x,C_{n}),d(y,C_{n})\}d(x,y)$$
$$\leq \left\vert d(x,C_{n})-d(z,C_{n})\right\vert +\min
\{d(x,C_{n}),d(z,C_{n})\}d(x,z)$$ $$+\left\vert d(z,C_{n})-d(y,C_{n})\right\vert
+\min \{d(z,C_{n}),d(y,C_{n})\}d(z,y)$$ for all $x,y,z.$ Let $%
r_{1}=d(x,C_{n}),r_{2}=d(y,C_{n}),r_{3}=d(z,C_{n})$. We consider six cases
depending on the way the numbers $r_{1},r_{2},r_{3}$ are ordered. It turns
out that the proof is easy when $r_{1}$ or $r_{2}$ is the smallest of the
three. We give the proof for the case $r_{3}\leq r_{1}\leq r_{2}$. (The case
$r_{3}\leq r_{2}\leq r_{1}$ is similar). We have to show that
$$r_{2}-r_{1}+r_{1}d(x,y)\leq r_{1}-r_{3}+r_{3}d(x,z)+r_{2}-r_{3}+r_{3}d(z,y)$$
which says $$r_{1}d(x,y)\leq 2r_{1}-2r_{3}+r_{3}d(x,z)+r_{3}d(z,y).$$ Since $d$
satisfies trangle inequality it suffices to show that $$%
r_{1}d(x,z)+r_{1}d(z,y)\leq 2r_{1}-2r_{3}+r_{3}d(x,z)+r_{3}d(z,y).$$ But this
last inequality is equivalent to $$(r_{1}-r_{3})[d(x,z)+d(z,y)]\leq
2r_{1}-2r_{3}.$$ This is true because $d(x,z)+d(z,y)\leq 1+1=2$.
Best Answer
You posted three questions. Here's an answer to the second one. No, $M$ doesn't need to be compact. Consider the space $\ell^2$ with its usual metric. For each $n\in\mathbb N$, let $e_n\in\ell^2$ be the sequence such that its $n$th term is $1$ and all others are $0$. Let$$M=\left\{\frac{e_n}m\,\middle|\,m,n\in\mathbb N\right\}\cup\{0\}.$$ Then every continuous function from $M$ into $\mathbb R$ is uniformly continuous. However, $M$ is not compact. For instance, the sequence $(e_n)_{n\in\mathbb N}$ has no convergent subsequence.