Let $M$ be a compact, connected, oriented smooth Riemannian manifold with non-empty boudary.
Let $f:M \to M$ be a smooth orientation preserving isometric immersion.
Is it true that $f$ is locally distance preserving?
(in the sense that around every $p \in M$ there exist a neighbourhood $U$ s.t $d(f(x),f(y))=d(x,y)$ for all $x,y \in U$)
This question is really about the boundary points of $M$.
In the interior this holds: Since $f(M^o) \subseteq M^o$ we can consider it as a map $M^o \to M^o$, and as such it is an arcwise isometry which is also a local homeomorphism, hence a local isometry w.r.t the intrinsic distance on $M^o$, hence also w.r.t the Riemannian distance on $M$.
A positive answer to this question, will settle these two questions.
Edit 1-Generalization:
Perhaps to better understand the question, let's see what happens when we broaden it a little.
Suppose $F:M \to N$ is an isometric immersion between two equidimensional Riemannian manifolds. Is it necessarily locally distance preserving?
(I do not assume here that $M,N$ are compact,connected,or oriented. In this more general case $F$ does not need to be a local diffeomorphism since it doesn't have to be open; Take e.g $M=N=[0,\infty),F(x)=x+1$).
Edit 2 - A proposed solution:
Let $p \in \partial M$. The idea is to use the inverse function theorem for points in $M^o$ which are close to $p$: Around each point of $M^o$, we can find a neighbourhood where $f$ is invertible, hence an isometry (since $f$ and its inverse are arcwise isometries, hence $1$-Lipschitz).
If we could obtain some lower bound on the size of these neighbourhoods*, then perhaps we can "push them" to the boundary, and deduce local distance preservation around it (via a continuity argument).
Details:
*By looking at the standard proof of the inverse function theorem, it turns out that in the Euclidean case, when $M=\mathbb{R}^d$, if
$$ B_r(p) \subseteq \{x \in \mathbb{R}^d \, | \, \|df_x-df_p\| \le \frac{1}{2}\|(df_p)^{-1} \|\} \tag{1}$$ then $$f \text{ is invertible at } B_r(p).$$
Moreover, in this case, $df_x \in O(n)$ for all $x$ implies $f$ is affine, i.e $df$ is a constant orthogonal matrix (A corollary of Liouville's theorem). Hence the premise in $(1)$ holds vacuously for every $r$.
Even when $M$ is flat (i.e only localy Euclidean), one can use this approach as follows:
Given $p \in \partial M$ we can take a sequence $p_n \to p, p_n \in M^o$. Then, around each $p_n$ there is a ball where $M$ is isometric to Euclidean space. Then, Liouville's theorem imply $df$ is locally constant around each $p_n$, hence (by connectivity) it is in fact a constant matrix. (Here there is a subtlety, I am identifying all the tangent spaces near $p$, with $\mathbb{R}^d$, since I am implicitly assuming that there is a neighbourhood of $p$ isometric to an open subset of $\mathbb{R}^d$ together with smooth parts of its boundary. Unfortunately, It is not clear I can asume this...).
Now for the general case, we can use normal coordinates around the point $p \in \partial M$, and hopefully obtain some estimate on the neighbourhoods size. ("Every metric is locally approximately Euclidean").