A subgroup $D$ of $G = M \circledast N$ is a diagonal subgroup provided:
$$D \cap M = 1 = D \cap N$$
$$DM = G = DN$$
(Where $\circledast$ is denoting the internal direct product of $M$ and $N$.)
$$$$
GOAL: Show that $G$ has a diagonal subgroup iff $M \cong N$.
First assume G has a diagonal subgroup as described. Since $G = M \circledast N$ is the internal direct product of $M$ and $N$ we know $M$ and $N$ are normal in $G$, $G=MN$ and $M \cap N = 1$.
We must show that $M \cong N$. $$$$ (Here are a few results that may or may not be helpful for getting to a solution.
If $G = M \circledast N$ then $G \cong M \times N$.
If $G = M \circledast N = M \circledast L$ then $N \cong L$.)
I need help with the other direction as well. You have my appreciation in advance.
The other direction is easy. When $M \simeq N$, then $G \simeq M \times M$ and $\{(m,m), m \in M\}$ is a diagonal subgroup (you are just writing elements of $M$ twice, so every needed check follows from this). Can you explain this? I don't get it.
Now, suppose that $G$ has a diagonal subgroup $D$. As Arturo suggested in his comment, consider the projection maps, $\pi_M : G \to M$ and $\pi_N : G \to N$. We want to determine $\pi_M(D)$. The projection map $\pi_M$ has kernel $N$, so the image of a subgroup $D$ is isomorphic to $DN/N$. Now, using the second isomorphism theorem $DN/N \simeq D/D \cap N = D$. But, since $DN=G$, this is also equal to $G/N \simeq M$.
By symmetry, repeating the argument with $\pi_N$ shows that $D \simeq M \simeq N$. So not only you have proved that $M \simeq N$, but that the cardinality of a diagonal subgroup is always $\frac{1}{2} |G|$.