Your question is equivalent to the following: does every pre-Hilbert space (= inner product space) $M$ admit an orthonormal basis?
It turns out that the answer is "no". A counter-example can be found in N. Bourbaki's Topological Vector Spaces, Exercise V.2.2.
I tried to solve the exercise, but I'm not quite sure that I understood it.
Let $H_1=\ell_2(\mathbb N)$, and $H_2=\ell_2(I)$, where $I$ is a set with cardinality $\mathfrak c$ (the continuum). Choose a linearly independent family $(x_i)_{i\in I}\subset H_1$ and an orthonormal basis $(e_i)_{i\in I}$ of $H_2$. Now let $H:=H_1\oplus H_2$ and $M:={\rm span}\,\{ x_i\oplus e_i;\; i\in I\}\subset H$. Let us try to show that $M$ admits no orthonormal basis.
First, note that, identifying $H_2$ with $\{ 0\} \oplus H_2\subset H$, we have $M\cap H_2=\{ 0\}$. This is rather easy to check using that fact that the $x_i$ are linearly independent.
Now, let us show that any orthonormal family $\mathcal Z\subset M$ is countable. To see this, choose an orthonormal basis $(f_n)_{n\in\mathbb N}$ of $H_1=\ell_2(\mathbb N)\subset H$ and observe that for any $n\in\mathbb N$, we have $\langle f_n, z\rangle=0$ for all but countably many $z\in\mathcal Z$, because $\sum_{z\in\mathcal Z}\vert \langle f_n,z\rangle\vert^2<\infty$. Since by the previous remark, any $z\in\mathcal Z$ must satisfy $\langle f_n ,z\rangle\neq 0$ for at least one $n\in\mathbb N$ (otherwise we would have $z\in H_1^{\perp}=H_2$ and hence $z=0$), it follows that $\mathcal Z$ must be countable. Indeed, we have $\mathcal Z=\bigcup_{n\in\mathbb N} \mathcal Z_n$, where $\mathcal Z_n=\{ z;\; \langle f_n,z\rangle\neq 0\}$ is countable for each $n$.
It follows that if $M$ were to admit an orthonormal basis, then it would be separable. But this is not possible because
$\pi_2(M)$ is dense in $H_2$ (since it contains all the vectors $e_i$) and $H_2$ is not separable.