If we deal with a commutative ring:
Let $p$ be a prime with $p=ab$. Then some $r$ exists with $a=rp\vee b=rp$. If $a=rp$ then we have $p=rpb$ leading to $p(1-rb)=0$ hence $1=rb$ showing that $b$ is a unit. Conclusion: $p$ is irreducible. Of course $b=rp$ leads to the same conclusion.
You could say that this doesn't have to work if the ring is not commutative because we also need $1=br$. Normally prime and irreducible elements are defined in commutative rings.
addendum concerning non-commutative ring (with thanks to @rschwieb).
$1=rb$ implies that $r(1-br)=0$ hence also $br=1$. Proved is now that $b$ is a unit.