Assume \(p \nmid a\). Since \(p\) is a prime, then \(gcd(p ,a)\) is either 1 or \(p\), but since \(p \nmid a\) then \(p \ne gcd(p, a)\), so it has to be 1. So far we know two things:
$$\begin{gathered} p|ab \\ gcd(p, a) = 1\end{gathered}$$
Let \(x, y \in ℤ \).
$$\begin{gathered} 1 = xp + ya\\ b = bxp + bya \end{gathered}$$
Since \(p \mid ab\) and \(p \mid bp \), then \(p \mid (y(ab) + x(bp)) \) or \(p \mid (bxp + bya)\). Therefore, \(p \mid b\).