Since $ab$ is a unit, there is an element $c\in R$ such that $abc=1=cab$. To show that $a$ is a unit, it is enough to show that $bca=1$, for then $bc$ is both a left and right inverse of $a$.
Starting with $abc=1$ and multiplying both sides on the right by $a$, we obtain $abca=a$, or $a(bca-1)=0$. Since $a$ is not a zero divisor, this implies that $bca=1$.
A similar argument, starting with $cab=1$, shows that $b$ is also a unit.