Theorem: For positive integers $a$ and $b$ we have:

$$\gcd(a,b)\text{lcm}(a,b)=ab.$$

Using this, suppose $\text{lcm}(a,b)=ab$ it follows that $\gcd(a,b)=1$. Also on the other way suppose $\gcd(a,b)=1$, using the above theorem we conclude that $\text{lcm}(a,b)=ab$.


If we have the prime decompositions of $a$ and $b$: $$ a = 2^{a_2} \cdot 3^{a_3}\cdot 5^{a_5}\cdots \qquad b = 2^{b_2} \cdot 3^{b_3}\cdot 5^{b_5}\cdots $$ where only a finite number of $a_p, b_p$ are non-zero, then we get $$ \gcd(a, b) = 2^{\min(a_2, b_2)}\cdot 3^{\min(a_3, b_3)}\cdot 5^{\min(a_5, b_5)}\cdots \\ \operatorname{lcm}(a, b) = 2^{\max(a_2, b_2)}\cdot 3^{\max(a_3, b_3)}\cdot 5^{\max(a_5, b_5)}\cdots $$ From there it's not difficult to conclude that $\operatorname{lcm}(a, b)\cdot \gcd(a, b) = ab$ (they must be equal, since they have the same prime decomposition), and then what you want to show follows easily.


If you want to do this without prime factorization and without the gcd-lcm theorem, here is another approach.

By the way, I am assuming here that $a$ and $b$ are positive integers.

Let $d=\gcd(a,b)$ and let $m=\mbox{lcm}(a,b)$.

Note that $\frac{ab}{d}=\frac{a}{d}\cdot b=\frac{b}{d}\cdot a$ is a common multiple of $a$ and $b$. So if $d>1$, $\frac{ab}{d}$ is a common multiple of $a$ and $b$ that is less than $ab$. So in this case, we would have $m<ab$. Then by contrapositive, $m=ab\Rightarrow d=1$.

For the other direction, if $m<ab$, then $m=ax=by$ for some positive integers $x,y$ with $x<b$ and $y<a$. Then $\frac{a}{y}=\frac{b}{x}$, and this common value is a common factor of $a$ and $b$. However, since $y<a$, this common factor, $\frac{a}{y}$, is greater than $1$. Thus $d>1$. So again by contrapositive, $d=1\Rightarrow m=ab$.


Hint $ $ Notice $\,n\mapsto ab/n\,$ bijects the common divisors of $\,a,b\,$ with the common multiples $\le ab.$ Being order-$\rm\color{#c00}{reversing}$, it maps the $\rm\color{#c00}{Greatest}$ common divisor to the $\rm\color{#c00}{Least}$ common multiple, i.e. $\,{\rm\color{#c00}{G}CD}(a,b)\mapsto ab/{\rm GCD}(a,b) = {\rm \color{#c00}{L }CM}(a,b).\,$ Therefore $\ {\rm GCD}(a,b)=1\iff {\rm LCM}(a,b) = ab$.

Remark $\ $ For more on this (involution) duality between gcd and lcm see here and here.