Prime $\Rightarrow$ irreducible is obvious if we employ a definition of irreducible in associate (vs. $\rm\color{#0a0}{unit}$) form. Then $\,\color{#c00}{ p=ab\,\Rightarrow\, p\mid ab}\,$ immediately yields the sought inference, as follows.
Theorem $\ \ $ In the following, $\,\ (1)\,\Rightarrow\,(2)\!\iff\! (3)$
$(1)\ \ \ \color{#c00}{p\ \mid\ ab}\ \Rightarrow\ p\:|\:a\ \ {\rm or}\ \ p\:|\:b\quad$ [Definition of $\:p\:$ is prime]
$(2)\ \ \ \color{#c00}{p=ab}\ \Rightarrow\ p\:|\:a\ \ {\rm or}\ \ p\:|\:b\quad$ [Definition of $\:p\:$ is irreducible, in associate form]
$(3)\ \ \ p=ab\ \Rightarrow\ a\:|\:1\ \ {\rm or}\ \ b\:|\:1\quad$ [Definition of $\:p\:$ is irreducible, in $\rm\color{#0a0}{unit}$ form]
Proof $\ \ \ (1\Rightarrow 2)\,\ \ \ \color{#c00}{p = ab\, \Rightarrow\, p\mid ab}\,\stackrel{(1)}\Rightarrow\,p\mid a\:$ or $\:p\mid b.\ $ Hence prime $\Rightarrow$ irreducible.
$(2\!\!\iff\!\! 3)\ \ \ $ If $\:p = ab\:$ then $\:\dfrac{1}b = \dfrac{a}p\:$ so $\:p\:|\:a\iff b\:|\:1.\:$ Similarly $\:p\:|\:b\iff a\:|\:1.$
Beware that factorization theory is more complicated in non-domains. Basic notions such as associate and irreducible bifurcate into a few inequivalent notions. See here for more on that.