This is proven e.g. in Bourbaki, Lie Groups and Algebras vol. VI §1 no.4 Proposition 12; or in Humphreys, Introduction to Lie Algebras and Representation Theory, §10.4, Lemma C.
We have (see e.g. Dietrich Burde's answer to Two questions on roots of finite, simple, complex lie algebra):
(*) If $\alpha, \beta$ are two roots which are not perpendicular to each other, and w.l.o.g. $(\alpha, \alpha) \le (\beta, \beta)$, then
$$\dfrac{(\beta, \beta)}{(\alpha, \alpha)} \in \{1,2,3\}.$$
Now assume an irreducible root system $\Phi$ (in its Euclidean space $E$) contains three roots $\alpha, \beta, \gamma$ of mutually different lengths. W.l.o.g. $(\alpha, \alpha)=1$. Now the obvious idea is that if e.g. $(\beta, \beta) = 2$ and $(\gamma, \gamma)=3$, we would have $\dfrac{(\gamma, \gamma)}{(\beta, \beta)} =\frac32 \notin \{1,2,3\}$ in contradiction to the above. The problem is that a priori, some or all of our three roots could be perpendicular to each other. And indeed one can easily construct such examples if the root system is not irreducible, e.g. in $A_1 \times A_1 \times A_1$, which is made up of three mutually orthogonal roots (and their negatives), each of them can have any positive length you want.
To exclude that, we need to move our roots around a bit until they are not orthogonal to each other. We do that with the Weyl group $W$ of our root system
Fact: $\{w(\alpha): w \in W\}$ spans $E$. (And for this we need irreducibility.)
This implies that for any root $\phi$, there is some $w \in W$ such that $w(\alpha)$ is not perpendicular to $\phi$ (because if they all were, so would be their span $E$, but that contains $\phi \in \Phi$).
In particular, there is a $w_1\in W$ such that $\alpha':=w_1(\alpha)$ is not perpendicular to $\beta$, and a $w_2\in W$ such that $\alpha'' := w_2(\alpha)$ is not perpendicular to $\gamma$. Since it's clear or easily proven that for any $w \in W$, $(w(\phi),w(\phi))= (\phi, \phi)$, this allows us to use (*) for the first time and infer w.l.o.g. that $(\beta, \beta) = 2$ and $(\gamma, \gamma)=3$. But then we apply the fact again to find $w_3$ with $w_3(\beta)$ not perpendicular to $\gamma$, and can conclude as wanted.