This is true precisely because the rationals $\mathbb Q$ comprise a multiplicative subsemigroup of the reals $\mathbb R,$
i.e. the subset of rationals is closed under the multiplication operation of $\mathbb R$. Your statement arises by taking the contrapositive of this statement - which transfers it into an equivalent statement in the complement set $\mathbb R \backslash \mathbb Q$ of irrational reals.
Thus $\rm\quad\quad\quad r_1,\ldots,r_n \in \mathbb Q \;\Rightarrow\; r_1 \cdots r_n \in \mathbb Q$
Contra+ $\rm\quad\; r_1 r_2\cdots r_n \not\in \mathbb Q \;\Rightarrow\; r_1\not\in \mathbb Q \;\:$ or $\rm\;\cdots\;$ or $\rm\;r_n\not\in\mathbb Q$.
Your case $\rm\;\;\; r^n\not\in \mathbb Q \;\Rightarrow\; r\not\in \mathbb Q \;$ is the special constant case $\rm r_i = r$
Obviously the same is true if we replace $\rm\mathbb Q\subset \mathbb R$ by any subsemigroup chain $\rm G\subset H$
The contrapositive form is important in algebra since it characterizes prime ideals in semigroups, rings, etc.