Here's a different point of view that leads to the same answer as Ross's.
Think of the matrices as being matrices over the field of $p$ elements by reducing the entries modulo $p$. The determinant is divisible by $p$ (that is, $0$ modulo $p$) if and only if the rows of the matrix do not form a basis for $\mathbf{F}_p^2$, if ando nly if the rows are not linearly independent, if and only if one row is a multiple of the other.
To get trace that is not zero, you just need to avoid $a=0$, since $2a\equiv 0\pmod{p}$ if and only if $a\equiv 0 \pmod{p}$ (since $p$ is odd). Having chosen $a$ and an arbitrary $b$, the only way for the determinant to be a multiple of $p$ is if $(c,a) = k(a,b)$ for some $k\in\mathbf{F}_p$ (operation done modulo $p$). If $b=0$, then no choice of $c$ will do, since $a\neq 0$. So $b\neq 0$. If $b\neq 0$, then the only $k$ that can possibly work is $k\equiv ba^{-1}\pmod{p}$, which forces the value of $c$. So you have one and only one such matrix for each nonzero choice of $b$.
In summary: $p-1$ choices for $a$; $p-1$ choices for $b$; once $a$ and $b$ are fixed (both necessarily nonzero), $c$ is forced by the condition that $(c,a)$ must be a scalar multiple of $(a,b)$.