It's easy by prime factorization. More generally by gcds we explicitly show $\rm\:a,c\:$ are squares:
Lemma $\rm\,\ \ \color{#0a0}{(a,b,c) = 1},\,\ \color{#c00}{b^2 = ac}\ \Rightarrow\ a = (a,b)^2,\ c = (c,b)^2\ $ for $\rm\:a,b,c\in \mathbb N$
Proof $\rm\ \ (a,b)^2 = (a^2,ab,\color{#c00}{b^2}) = (a^2,ab,\color{#c00}{ac}) = a\color{#0a0}{(a,b,c)} = a.\,$ Same for $\rm\,(c,b).\,$ $\ \bf\small QED$
Yours is the special case $\rm\:(a,c) = 1\ (\Rightarrow\ (a,b,c) = 1)$. Note that the above proof uses only basic gcd arithmetic, i.e. universal gcd laws (associative, commutative, distributive) therefore it generalizes to any gcd domain/monoid, e.g. any UFD.
Generally $\rm\, ac = bd\Rightarrow (a,b)(a,d) = (aa,ab,bd,ad) = a\, \color{#0a0}{(a,b,c,d)} = a\,$ if $\rm\,\color{#0a0}{(a,b,c,d) = 1}.\:$ For more on this and related topics such as Euler's Four Number Theorem (Vierzahlensatz), Riesz interpolation, or Schreier refinement see here and here .