Hint Let $m$ be a prime number dividing $q$. Then $m|q^2|p^2$ thus $m|p$. Do you see the contradiction?
Here is the complete proof:
As $q \neq 1$ there exists a prime number $m$ dividing $q$.
Then, as $m|q$ we have $m|q \cdot q=q^2$.
As $p^2=a^2q^2$ and $a^2$ is integer, we have $q^2|p^2$.
Therefore $m|q^2$ and $q^2|p^2$. This implies $m|p^2$.
Since $m$ is prime and $m|p \cdot p$ then $m|p$.
This proves that $m|p$. As $m|q$, this contradicts the fact that $p,q$ are relatively prime.
P.S. If you want a constructive proof, the same idea can be combined with the Fundamental Theorem of Arithmetic to prove that if $q^2|p^2$ then $q|p$.
Exactly as above you can first prove that all primes dividing $q$ must also divide $p$, and then you can prove that their power in $q$ is smaller than their power in $p$. I preferred the contradiction proof since it is much shorter.