Let $a$ and $b$ are integers.
If $a \ne b$, then $ab \ne 1$.
Proving the contrapositive: If $ab = 1$ then $a = b$. If $ab = 1$, then there are two possibilities. $a = b = 1$ or $a = b = -1$. No other choice of $a$ and $b$ can make $ab = 1$. In both these cases, $a = b$.
Is the proof correct? Can I have a direct proof?
Your proof is correct, although you are a bit fast on the part "the only options are $a=b=1$ and $a=b=-1$.
A direct proof can be as follows:
Assume $ab=1$. Then $a\neq 0$ and $b\neq 0$.
If $a>1$ or $a<-1$ then $a$ has a prime factor $p$, therefore $p\mid ab$ which contradicts $ab=1$.
Therefore $a\in\{-1,1\}$ and by symmetry $b\in\{-1,1\}$ as well. Now $a$ and $b$ have to be equal otherwise $ab=-1$.