The answer is yes, by a series of reductions.

Given a polynomial $f(x)$, there is a unique polynomial $g(x)$ of the same degree whose roots are the squares of the roots of $f$. We can compute its coefficients with the equation $g(x^2)=f(x)f(-x)$. Suppose $g(x)$ is the characteristic polynomial of $X$. we can easily construct a diagonalizable matrix $S'$ with characteristic polynomial $f(x)$. Then $S'^2$ will have characteristic polynomial $g(x)$. Since $S'^2$ and $X$ will both be diagonalizable, they will be conjugate over $\mathbb C$, hence, by rational canonical form, they will be conjugate over $\mathbb Q$. (A symmetric matrix over $\mathbb Q$ is diagonalizable over $\mathbb R$.) Say $A S'^2 A^{-1}=X$, then $(AS'A^{-1})^2=X$, so set $S = A S'A^{-1}$, then $S^2 = (AS'A^{-1})^2=X$.

Conversely, if such an $S$ exists, then its characteristic polynomial is such an $f(x)$. So having a solution to the equation is equivalent to having a polynomial $f(x)$ such that $g(x)$ is the characteristic polynomial. So your question is equivalent to: Does the Hasse principle hold for the problem of, given a polynomial $g(x)$, finding a polynomial $f(x)$ such that $f(x)f(-x)=g(x^2)$?

Given a polynomial $g(x)$, we can factor it into irreducibles. $f(x)$ must handle each irreducible separately, unless some irreducible appears with even multiplicity, since $g(x^2) g( (-x)^2) = \left(g(x^2)\right)^2$. So it is sufficient to check the Hasse principle for an irreducible $g(x)$.

For an irreducible $g(x)$, this equation has a solution over $\mathbb Q$ if and only if the element $x$ in the number field $\mathbb Q(x)/g(x)$ is a perfect square. Otherwise, the extension that comes from adjoining its square root will have a degree too large, and there will be no irreducible polynomial defining its square root. This equation has a solution over $\mathbb Q_p$ if and only if the element $x$ in the product of local fields $\mathbb Q_p(x)/g(x)$ is a perfect square. This is because, in $\mathbb Q_p$, $g(x)$ factors as a product of distinct terms, hence each term must individually have a square root.

So the equation has a solution over each place of $\mathbb Q$ if and only if the equation $y^2=x$ has a solution over each place of $\mathbb Q(x)/g(x)$. By the Chebotarev Density Theorem, this final equation satisfies the Hasse principle.