[proofplan]
Choose a partition of $[a,b]$ on which $\gamma$ is smooth. On each smooth subinterval, differentiate the composition $f\circ\gamma$ and use the metric-preserving property of the differential $df$ to show that the $h$-speed of $f\circ\gamma$ equals the $g$-speed of $\gamma$ pointwise. The Riemannian lengths are the sums of the one-dimensional Lebesgue integrals of these speeds over the smooth pieces, so equality of speeds gives equality of lengths after summing over the partition.
[/proofplan]
[step:Dispose of the degenerate parameter interval]
If $a=b$, then the parameter interval is degenerate. By the definition of the length functionals stated in the theorem, both lengths are zero:
\begin{align*}
L_g(\gamma)=0
\end{align*}
and
\begin{align*}
L_h(f\circ\gamma)=0.
\end{align*}
Hence
\begin{align*}
L_h(f\circ\gamma)=L_g(\gamma).
\end{align*}
For the rest of the proof, assume $a<b$.
[/step]
[step:Choose a smooth partition for the piecewise smooth curve]
Since $\gamma:[a,b]\to M$ is piecewise smooth and $a<b$, there is a finite partition
\begin{align*}
a=t_0<t_1<\cdots<t_m=b
\end{align*}
such that, for each index $j\in\{1,\dots,m\}$, the restricted curve
\begin{align*}
\gamma_j:[t_{j-1},t_j]\to M
\end{align*}
defined by $\gamma_j(t)=\gamma(t)$ is smooth on the subinterval in the piecewise-smooth sense. Since $f:M\to N$ is smooth, each composition
\begin{align*}
f\circ\gamma_j:[t_{j-1},t_j]\to N
\end{align*}
is smooth. Hence $f\circ\gamma$ is piecewise smooth with respect to the same partition.
[/step]
[step:Compute the speed of the composed curve on each smooth piece]
Fix $j\in\{1,\dots,m\}$ and fix a point $t\in(t_{j-1},t_j)$ at which $\gamma_j$ is differentiable. The velocity vector of $\gamma$ at $t$ is
\begin{align*}
\gamma'(t)\in T_{\gamma(t)}M.
\end{align*}
Differentiating the composition gives
\begin{align*}
(f\circ\gamma)'(t)=df_{\gamma(t)}(\gamma'(t))\in T_{f(\gamma(t))}N.
\end{align*}
Using the metric-preserving property of the Riemannian isometry $f$ with $p=\gamma(t)$ and $v=w=\gamma'(t)$, we obtain
\begin{align*}
h_{f(\gamma(t))}((f\circ\gamma)'(t),(f\circ\gamma)'(t))=g_{\gamma(t)}(\gamma'(t),\gamma'(t)).
\end{align*}
By the norm notation fixed in the theorem statement, taking the non-negative square root of both sides gives equality of speeds:
\begin{align*}
\|(f\circ\gamma)'(t)\|_{h,f(\gamma(t))}=\|\gamma'(t)\|_{g,\gamma(t)}.
\end{align*}
Thus this equality holds at every differentiability point of $\gamma_j$ in $(t_{j-1},t_j)$. Since a smooth piece can fail to be differentiable only at the endpoints when viewed as part of the piecewise smooth curve, the equality holds $\mathcal{L}^1$-almost everywhere on $[t_{j-1},t_j]$.
[guided]
Fix one smooth piece of the curve, indexed by $j\in\{1,\dots,m\}$. On the open interval $(t_{j-1},t_j)$, the curve has a well-defined velocity
\begin{align*}
\gamma'(t)\in T_{\gamma(t)}M.
\end{align*}
The composed curve $f\circ\gamma$ has values in $N$, and its velocity at the same parameter value lies in the tangent space at the image point:
\begin{align*}
(f\circ\gamma)'(t)\in T_{f(\gamma(t))}N.
\end{align*}
The differential of $f$ at $\gamma(t)$ is the [linear map](/page/Linear%20Map)
\begin{align*}
df_{\gamma(t)}:T_{\gamma(t)}M\to T_{f(\gamma(t))}N.
\end{align*}
Differentiating the composition therefore identifies the velocity of the image curve as
\begin{align*}
(f\circ\gamma)'(t)=df_{\gamma(t)}(\gamma'(t)).
\end{align*}
Now the hypothesis that $f$ is a Riemannian isometry is used exactly at the tangent vector $\gamma'(t)$. Since $f$ preserves the metric on tangent vectors, for every $p\in M$ and every $v,w\in T_pM$,
\begin{align*}
h_{f(p)}(df_p(v),df_p(w))=g_p(v,w).
\end{align*}
Taking $p=\gamma(t)$ and $v=w=\gamma'(t)$ gives
\begin{align*}
h_{f(\gamma(t))}(df_{\gamma(t)}(\gamma'(t)),df_{\gamma(t)}(\gamma'(t)))=g_{\gamma(t)}(\gamma'(t),\gamma'(t)).
\end{align*}
Substituting the velocity identity for the composed curve yields
\begin{align*}
h_{f(\gamma(t))}((f\circ\gamma)'(t),(f\circ\gamma)'(t))=g_{\gamma(t)}(\gamma'(t),\gamma'(t)).
\end{align*}
The speed of a Riemannian curve is the non-negative square root of the metric applied to its velocity vector. Therefore equality of the squared speeds implies equality of the speeds, using the norm notation fixed in the theorem statement:
\begin{align*}
\|(f\circ\gamma)'(t)\|_{h,f(\gamma(t))}=\|\gamma'(t)\|_{g,\gamma(t)}.
\end{align*}
This equality holds at every differentiability point of the smooth piece. When we integrate over the closed interval $[t_{j-1},t_j]$, the only additional points are endpoints of smooth pieces, and a finite set has $\mathcal{L}^1$-measure zero. Hence the speed equality holds $\mathcal{L}^1$-almost everywhere on $[t_{j-1},t_j]$. This almost-everywhere equality is the whole mechanism of the theorem: a Riemannian isometry preserves tangent-vector lengths, and the length of a curve is obtained by integrating the tangent-vector length along the parameter interval.
[/guided]
[/step]
[step:Integrate the equal speeds over each subinterval]
For each $j\in\{1,\dots,m\}$, the definition of Riemannian length on a smooth piece, with respect to the one-dimensional [Lebesgue measure](/page/Lebesgue%20Measure) $\mathcal{L}^1$ named in the theorem statement, gives
\begin{align*}
L_h((f\circ\gamma)|_{[t_{j-1},t_j]})=\int_{t_{j-1}}^{t_j}\|(f\circ\gamma)'(t)\|_{h,f(\gamma(t))}\, d\mathcal{L}^1(t).
\end{align*}
By the $\mathcal{L}^1$-almost-everywhere speed equality from the previous step, the integrands define the same [Lebesgue integral](/page/Lebesgue%20Integral) on $[t_{j-1},t_j]$. Therefore
\begin{align*}
\int_{t_{j-1}}^{t_j}\|(f\circ\gamma)'(t)\|_{h,f(\gamma(t))}\, d\mathcal{L}^1(t)=\int_{t_{j-1}}^{t_j}\|\gamma'(t)\|_{g,\gamma(t)}\, d\mathcal{L}^1(t).
\end{align*}
By the definition of the Riemannian length of the smooth piece $\gamma|_{[t_{j-1},t_j]}$, the right-hand side is
\begin{align*}
L_g(\gamma|_{[t_{j-1},t_j]}).
\end{align*}
The possible breakpoints $t_0,\dots,t_m$ do not affect these integrals, because they form a finite subset of $[a,b]$ and hence have $\mathcal{L}^1$-measure zero.
[/step]
[step:Sum over the smooth pieces to obtain equality of total length]
By the definition of the length functionals stated in the theorem, the length of a piecewise smooth curve is obtained by summing the Lebesgue-integral lengths over the smooth pieces of any partition on which the curve is smooth. Applying this definition to the partition $a=t_0<t_1<\cdots<t_m=b$,
\begin{align*}
L_h(f\circ\gamma)=\sum_{j=1}^{m} L_h((f\circ\gamma)|_{[t_{j-1},t_j]}).
\end{align*}
Using the equality of the corresponding piece lengths from the previous step, we get
\begin{align*}
L_h(f\circ\gamma)=\sum_{j=1}^{m} L_g(\gamma|_{[t_{j-1},t_j]}).
\end{align*}
Applying again the definition of the length of the piecewise smooth curve $\gamma$, the right-hand side is
\begin{align*}
\sum_{j=1}^{m} L_g(\gamma|_{[t_{j-1},t_j]})=L_g(\gamma).
\end{align*}
Thus
\begin{align*}
L_h(f\circ\gamma)=L_g(\gamma),
\end{align*}
as required.
[/step]