Let $(X_1,d_1),(X_2,d_2)$ be compact connected metric spaces, and let $f:X_1 \to X_2$ be surjective and non-expansive ,i.e $$d_2(f(x),f(y)) \leq d_1(x,y).$$
Assume $\operatorname{diam}(X_1)=\operatorname{diam}(X_2)$. Is it true that $f$ is an isometry?
(The answer is known to be positive in the case where $(X_1,d_1)=(X_2,d_2)$).
Update:
It turns out the answer is negative ($f$ does not have to be an isometry, see Daniel Fischer's answer below).
An interesting point:
There is no way to adapt Daniel's idea to create a "smooth" (Riemannian) one-dimensional example.
Since every two compact connected one-dimensional Riemannian manifolds with equal diameters are isometric, there exists an isometry $\phi:X_2 \to X_1$. Thus, $f \circ \phi:X_2 \to X_2$ is a surjective nonexpanding map from a compact metric space to itself, hence an isometry.
It turns out that it is possible to build Riemannian examples in higher dimensions where $f$ is not an isometry (see again Daniel's answer).
$f$ need not be an isometry. Let $X_1 = [0,3],\, X_2 = [0,2]$, and $d_i(x,y) = \min \{ \lvert x-y\rvert, 1\}$. Then $X_1,X_2$ are compact metric spaces with diameter $1$, and $f \colon x \mapsto \frac{2}{3} x$ is a non-expansive homeomorphism that is not an isometry.
Regarding the addendum: If we allow manifolds with boundary, we can take for example two ellipses with the same diameter, like
$$X_1 = \bigl\{ (x,y) \in \mathbb{R}^2 : \tfrac{x^2}{100} + y^2 \leqslant 1\bigr\},\quad X_2 = \bigl\{ (x,y) \in \mathbb{R}^2 : \tfrac{x^2}{100} + 4y^2 \leqslant 1\bigr\}$$
with the Euclidean metric inherited from $\mathbb{R}^2$. Then $f \colon (x,y) \mapsto (x,y/2)$ is a non-expansive diffeomorphism but not isometric.
I think we get an example without boundaries for ellipsoids
$$X_1 = \bigl\{ (x,y,z) : a^2 x^2 + b^2 y^2 + c^2 z^2 = 1\bigr\},\quad X_2 = \bigl\{ (x,y,z) : a^2 x^2 + b^2 y^2 + d^2 z^2 = 1\bigr\}$$
and $f \colon (x,y,z) \mapsto (x,y,cz/d)$ with $a < c < d < b$ when $a$ is small enough, $b$ large enough and $d-c$ small, but without computation, I can't guarantee that the diameters are indeed equal [that the points farthest apart in both ellipsoids are $(-1/a,0,0)$ and $(1/a,0,0)$].