No, it is not true. Suppose that you are working on $\mathbb{R}^2$ endowed with its usual inner product. Take $U=\mathbb{R}\times\\{0\\}$ and $W=\\{(x,x)\,|\,x\in\mathbb{R}\\}$. Then $\\{(1,0)\\}$ is an orthonormal basis of $U$, $\left\\{\frac1{\sqrt2}(1,1)\right\\}$ is an orthonormal basis of $W$, and $\left\\{(1,0),\frac1{\sqrt2}(1,1)\right\\}$ is _not_ an orthonormal basis of $\mathbb{R}^2$.