The following is more general than for the integers, and therefore simpler (but longer than a proof using unique factorisation without proving it; here we start from scrap).
Let $R$ be an integral domain, where $d=gcd(a,b)$ is defined to mean that $dmid a,b$ and $d’mid a,bimplies d’mid d$ for all $d’in R$, while $deflcm{operatorname{lcm}}m=lcm(a,b)$ is defined to mean that $a,bmid m$ and $a,bmid m’implies mmid m’$ for all $m’in R$ (in both cases it is not implied that $gcd(a,b)$ or $lcm(a,b)$ always exist, and if they do they are only unique up to multiplication by invertible elements; as a consequence in this setting the equality $gcd(a,b)timeslcm(a,b)=ab$ can only be asserted up to such multiplication, or for properly chosen values on the left hand side).
Lemma. Let $rin Rsetminus{0}$, and put $D_r={, din R: dmid r,}$, the set of divisors of $r$. Then $f_r:dmapsto r/d$ defines an involution of $D_r$ which is an anti-isomorphism for the divisibility relation: for $a,bin D_r$ one has $amid biff f(b)mid f(a)$.
Proof. Since by definition $d f(d)=r$ for all $din D_r$ one has $f(d)in D_r$ and $f(f(d))=d$. Suppose $a,bin D_r$ satisfy $amid b$, so there exists $cin R$ with $ac=b$, then $r=bf(b)=acf(b)$ so $f(a)=cf(b)$ and $f(b)mid f(a)$. Conversly if $f(b)mid f(a)$ applying this result gives $f(f(a))mid f(f(b))$ which simplifies to $amid b$. QED
Proposition. If $abneq0$ and $m=lcm(a,b)$ exists, then $ab/m=gcd(a,b)$.
Proof. One has $a,bmid ab$ so $mmid ab$ by definition of the $lcm$; therefore $a,b,min D_{ab}$. One has $f_{ab}(a)=b$ and $f_{ab}(b)=a$, and since $a,bmid m$ one has $f_{ab}(m)mid b,a$ by the lemma. Also if $d’in R$ satisfies $d’mid a,b$ then $d’in D_{ab}$ so $b,amid f_{ab}(d’)$ by the lemma, whence $mmid f_{ab}(d’)$ by definition of the $lcm$, and once again by the lemma $d’mid f_{ab}(m)$. Thus $$ab/m=f_{ab}(m)=gcd(a,b). qquadtext{QED}$$
Concluding $gcd(a,b)times lcm(a,b)=ab$ needs the precaution that it only holds if $lcm(a,b)$ exists, and then the left hand side is defined up to invertible factors only, so the equality should be interpreted in this sense. For the case $ab=0$ not covered by the proposition one has $0=lcm(a,b)$ and ${a,b}={0,gcd(a,b)}$, so the equality holds without any difficulty.
Note that the existence of $gcd(a,b)$ does not imply the existence of $lcm(a,b)$ in general.
