Solution 1:

Your argument can be firmed up to show that $f$ preserves the lengths of curves. This in turn implies that $f$ is nonexpanding, i.e. $d'(f(x_1),f(x_2))\leq d(x_1,x_2)$. But without knowing that $f^{-1}$ is continuous, it's conceivable that there's some path in $Y$ from $f(x_1)$ to $f(x_2)$ which is not the image of a path in $X$ and has a shorter length than all such paths. That would stop $f$ from being an isometry. We can show that a bijective local isometry is a global isometry if and only if $f^{-1}$ is continuous.

By length space, I assume you mean a metric space whose induced arc-length metric agrees with the original metric (which, in particular, implies that the space is path-connected). And by local isometry, I assume you mean a map $f:(X,d) \to (Y,d')$ such that every point $x \in X$ has a neighborhood $U$ in which $d'(f(x_1),f(x_2))=d(x_1,x_2)$ for all $x_1,x_2 \in U$.

Claim 1. A local isometry between length spaces preserves the lengths of curves.

Proof. Let $\gamma:[0,1] \to X$ be a path from $x_0=\gamma(0)$ to $x_1=\gamma(1)$. Given $\epsilon>0$, we can find a subdivision $t_0<\cdots<t_n$ such that $$\sum_{i =1}^n d'(f(\gamma(t_i)),f(\gamma(t_{i+1})))<L_{d'}(f\circ \gamma)+\epsilon.$$ We can cover the image of $\gamma$ in $X$ with open sets on which $f$ is an isometry. This image is compact, so we can extract a finite subcover. It's straightforward to see that we can add terms to the subdivision $t_0<\cdots<t_n$ until each interval $[t_i,t_{i +1}]$ is mapped into one of the open sets on which $f$ is an isometry. (For example, pull back the finite cover and use the Lebesgue Number Lemma.) By adding even more terms, we ensure that $$\sum_{i =1}^n d(\gamma(t_i),\gamma(t_{i+1}))<L_{d}( \gamma)+\epsilon.$$ Now we have \begin{align*} L_d(\gamma)&< \epsilon+\sum_{i =1}^n d(\gamma(t_i),\gamma(t_{i+1}))\\ &=\epsilon+\sum_{i =1}^n d'(f(\gamma(t_i)),f(\gamma(t_{i+1})))\\ &\leq L_{d'}(f\circ \gamma)+\epsilon. \end{align*} We also have \begin{align*} L_{d}(\gamma) &>\sum_{i =1}^n d(\gamma(t_i),\gamma(t_{i +1}))-\epsilon\\ &=\sum_{i =1}^n d'(f(\gamma(t_i)),f(\gamma( t_{i +1})))-\epsilon\\ &\geq L_{d'}(f\circ \gamma)-\epsilon, \end{align*} as desired.

Claim 2. If a bijective local isometry between length spaces has a continuous inverse, then it is a global isometry.

Proof. Since $f^{-1}$ is continuous, each neighborhood $U$ on which $f$ is an isometry is carried to an open set $(f^{-1})^{-1}(U)=f(U)$. Then it is easy to see that $f^{-1}$ is an isometry on $f(U)$. It follows that $f^{-1}$ is also a local isometry, hence preserves the lengths of curves. This means $f$ respects the arc-length metric. And since the arc-length metric agrees with the original metric, we conclude that $f$ is a global isometry. $\square$