Solution 1: $p \nmid q - 1$ implies $(p, q - 1) = 1$. If $q$ divides $a$, then it must divide $b$, so $q \mid a - b$. Otherwise, $(q, a) = (q, b) = 1$, and since based on Fermat's little theorem $q \mid a^{q - 1} - b^{q - 1}$, we get $q \mid a^{(p, q - 1)} - b^{(p, q - 1)} = a - b$ (this is well known and follows promptly from the Euclidean algorithm).
Solution 2: The case when $q$ divides $a$ or $b$ follows the same structure as in the first solution. Denote by $b^{-1}$ the multiplicative inverse of $b$ modulo $q$. We have $q \mid (ab^{-1})^p - 1$, and as $q \mid (ab^{-1})^{q - 1} - 1$ based on Fermat's Little theorem, we get that $ord_q{(ab^{-1})} \mid p, q - 1$, so $ord_q{(ab^{-1})} = 1$, implying $q \mid ab^{-1} - 1$, from where we get the desired result.