Use the equation of motion for the Heisenberg picture operators to find
\begin{equation}
\frac{d}{dt} X = \frac{i}{\hbar} [H,X] = \frac{i}{\hbar} \frac{1}{2m}[P^2,X] = \frac{i}{\hbar} \frac{1}{2m} (-2 i \hbar P) = \frac{P}{m} \, ,
\end{equation}
and similarly
\begin{equation}
\frac{d}{dt} P = \frac{i}{\hbar} [H,P] = \frac{i}{\hbar} \frac{\omega^2 m}{2}[X^2,P] = \frac{i}{\hbar} \frac{\omega^2 m}{2} (2 i \hbar X) = - \omega^2 m X \,.
\end{equation}
Hence
\begin{equation}
\frac{d^2}{dt^2} X = \frac{1}{m} \frac{d}{dt}P = - \omega^2 X \, .
\end{equation}
Therefore, the general solution for $X$ is of the form
\begin{equation}
X = A \cos(\omega t) + B \sin(\omega t) \, .
\end{equation}
We can plug this solution in the equation for $P$ and find
\begin{equation}
P = - m \omega A \sin(\omega t) + m \omega B \cos(\omega t) \, .
\end{equation}
Notice that $A$ and $B$ are not completely arbitrary: since we must satisfy $[X,P] = i \hbar$, we must have $[A,B] = \frac{i \hbar}{m \omega}$. Hence, they certainly do not commute. Take this into account when computing $\langle X^2 \rangle$.