The problem statement is false if $M$ is not constrained. As Jan pointed out, you may use $M=0$ as a counterexample.
When $M$ is invertible, however, the problem statement is indeed true. [Edit] The general theorem is this: if $A, B$ are real symmetric and $A$ is nonsingular, then they are simultaneously congruent to diagonal matrices if and only if $C=A^{-1}B$ is diagonalizable. See Horn and Johnson, Matrix Analysis, Theorem 4.5.15. For this particular question, however, we have a more elementary proof, which is given below.[End edit]
The main weapon for attacking the problem is Sylvester's law of inertia, which states that if $X$ is real symmetric and $M$ is invertible, then $X$ and $M^\top XM$ have the same number of positive, negative and zero eigenvalues.
Suppose $M^\top CM=\widehat{C}$ and $M^\top DM=\widehat{D}$ for some diagonal matrices $\widehat{C}$ and $\widehat{D}$. For any real number $\epsilon$, let $S_\epsilon=C+\epsilon D$. Then $\widehat{S}_\epsilon=M^\top SM$ is a diagonal matrix. Note that $C, D$ and $S_\epsilon$ all have exactly one positive eigenvalue, one negative eigenvalue and one zero eigenvalue. By Sylvester's law of inertia, So do $\widehat{C}, \widehat{D}$ and $\widehat{S}_\epsilon$. WLOG, assume the sign pattern of $\widehat{C}$ is $\widehat{C}=\textrm{diag}(+,-,0)$. Now there are two possibilities:
- The sign pattern of $\widehat{D}$ is $\textrm{diag}(0,+,-)$, $\textrm{diag}(0,-,+)$, $\textrm{diag}(+,0,-)$ or $\textrm{diag}(-,0,+)$. Then for sufficiently small $\epsilon\not=0$, $\widehat{C}+\epsilon\widehat{D}$ has three nonzero eigenvalues, which is a contradiction.
- The sign pattern of $\widehat{D}$ is $\textrm{diag}(+,-,0)$ or $\textrm{diag}(-,+,0)$. Therefore, for an appropriate value of $\epsilon$, the sign pattern of $\widehat{C}+\epsilon\widehat{D}$ would possess at least two zero eigenvalues. But this is again a contradiction. So we conclude that $C$ and $D$ cannot be simultaneously congruent to diagonal matrices.