Consider a point $p\in X$, and define the sequence $(x_n)_n$ inductively by setting $x_0=p$ and $x_{n+1}=f(x_n)$. Since $X$ is compact there exists a convergent sub-sequence $(x_{n_k})_k$. In particular we have
$$\lim_{k\to\infty}d(x_{n_{k+1}},x_{n_k})=0$$
That is
$$\lim_{k\to\infty}d(f^{n_{k+1}}(p),f^{n_{k}}(p))=0$$
Or, using the assumption
$$\lim_{k\to\infty}d(f^{n_{k+1}-n_k}(p),p)=0$$
Since $n_{k+1}-n_k\ge1$ the above result is equivalent to
$$\lim_{k\to\infty}d(f(y_k),p)=0\tag{1}$$
where $y_k=f^{n_{k+1}-n_k-1}(p)=x_{n_{k+1}-n_k-1}$. Now we can extract from $(y_k)_k$ a convergent sub-sequence $(y_{k_m})_m$ that converges to some $q\in X$, and $(1)$ then implies, (due to the continuity of $x\mapsto d(f(x),p)$), that
$$\lim_{m\to\infty}d(f(y_{k_m}),p)=d(f(q),p)=0$$
So $p=f(q)\in f(X)$. This proves that $f$ is onto.
Remark. Note that we only need that $d(f(x),f(y))\ge d(x,y)$ for every $ x,y$ in $X$.