Note the following theorem:
$n^2$ is even if and only if $n$ is even for all integers $n$.
Proof: $\Rightarrow$) Suppose $n$ is not even (i.e. $n$ is odd). Then $n=2k+1$ for some integer $k$. So $n^2 = 2(2k^2+2k)+1$ is also odd. Therefore if $n^2$ is even it must be that $n$ is even.
$\Leftarrow$) Suppose $n$ is even. Then $n=2k$ for some integer $k$ and $n^2 = 2(2k^2)$ is also even.
Even more generally, you can prove the following:
$n^2\equiv 0\mod p$ if and only if $n\equiv 0\mod p$ for all integers $n$ and prime numbers $p$.
Proof: $\Rightarrow)$ Suppose that $n\not\equiv 0\mod p$. That means $n=pk+r$ for some integer $k$ and some integer $r$ with $1\leq r\leq p-1$. Then $n^2 = p^2k^2 + 2pkr + r^2 = p(pk^2+2kr) + r^2$. Noting that $r^2\not\equiv 0\mod p$ (since $r\neq 0$ and $p\not\mid r$) you have $n^2\not\equiv 0\mod p$.
$\Leftarrow)$ Suppose $n\equiv 0\mod p$. Then trivially $n^2\equiv 0\mod p$.
Using this result, we see that since $a^2=pb^2$ that $p\mid a$. Furthermore, since $p\mid a$ we have $p^2\mid a^2$. Since $p^2\mid a^2$ we have $p^2\mid pb^2$ implying that $p\mid b^2$ implying that $p\mid b$.
So, we can factor out a $p^2$ from both sides of the equation and it will remain integers. Let $a=pa_2$ and $b=pb_2$. So $a^2=pb^2=p^2a_2^2=p\cdot p^2b_2^2$ and $a_2^2=pb_2^2$. Repeat the argument to show that $p\mid a_2$ and $p\mid b_2$ in order to form $a_2=pa_3$ and $b_2=pb_3$.
Repeating this argument ad nauseam implies that $p^N\mid a$ for all natural numbers $N$. This is, however, impossible since such an $a$ could not be finite.