Yes, this is true; in fact, any such $f$ must be a Möbius transformation. First, let us suppose $f(0)=0$. Then the Schwarz lemma implies $|f(z)|\leq |z|$ for all $z\in U$, with equality for some $z\neq 0$ iff $f(z)=cz$ for some $c$ with $|c|=1$. But we can also apply the Schwarz lemma to $f^{-1}$ to learn that $|f^{-1}(z)|\leq|z|$, and letting $z=f(w)$ gives $|w|\leq |f(w)|$. Thus in fact $|f(z)|=|z|$ for all $z$ and $f$ is of the form $f(z)=cz$.
In the general case where $f(0)\neq 0$, we may choose a bijective Möbius transformation $g:U\to U$ such that $g(f(0))=0$. The previous paragraph now shows that $g\circ f$ is a Möbius transformation, and hence so is $f$.