Here's Prob. 4, Sec. 3.9 in Introductory Functional Analysis With Applications by Erwine Kreyszig:
Let $H_1$ and $H_2$ be Hilbert spaces, and let $T \colon H_1 \to H_2$ be a bounded linear operator. If $M_1 \subset H_1$ and $M_2 \subset H_2$ and if $T(M_1) \subset M_2$, show that $T^*(M_2^\perp) \subset M_1^\perp$.
Here $T^*$ denotes the Hilbert adjoint operator of $T$.
Here's my proof:
Let $x \in M_2^\perp$. Then $$\langle x, v \rangle = 0 \ \mbox{ for all } \ v \in M_2.$$ Thus, in particular, we have $$\langle x, Tu \rangle = 0 \ \mbox{ for all } \ u \in M_1 $$ because $Tu \in M_2$ whenever $u \in M_1$.
But $\langle x, Tu \rangle = \langle T^*x, u \rangle$, by the definition of $T^*$. So we can conclude that $$\langle T^* x , u \rangle = 0 \ \mbox{ for all } \ u \in M_1,$$ and therefore $T^* x \in M_1^\perp$ whenever $x \in M_2^\perp$, as required.
Is the above proof correct?
Now can we derive the following result?
If $M_1 \subset H_1$, $M_2 \subset H_2$, and $T(M_1) \subset M_2$, then $T^*(M_2) \subset M_1$.
I know that this does indeed hold if $M_1$ and $M_2$ are closed subspaces of $H_1$ and $H_2$, respectively; in fact for closed subspaces, we can even make the if and only if statement.
But does this result hold otherwise?
Your initial part of the proof is correct. But even for closed subspace $M_1$ and $M_2$, you can have a bounded operator $T$ on $H$ such that $T(M_1)\subset M_2$ but $T^*(M_2)\nsubseteq M_1$.
For example take $H = l^2(\mathbb{N})$ and choose $M_1= M_2 =\{(a_n)\in l^2(\mathbb{N})|a_1=0\}$. Now consider the forward shift operator as $T$ i.e \begin{align} T\big((a_1,a_2,a_3,\cdots) \big)= (0,a_1,a_2,a_3,...) \end{align} So we will have $T^*$ as backward shift operator i.e \begin{align} T\big((a_1,a_2,a_3,\cdots) \big)= (a_2,a_3,a_4,...) \end{align} Note that $T(M_1) = \{(a_n)\in l^2(\mathbb{N})|a_1=0,a_2=0\}$. But $M_2= M_1$ is not invariant under $T^*$. In fact it turns out that in this case, $T^*(M_2)= H$.