This follows from fact that being geometrically integral is a constructible property. See Section 9 of EGAIV.

One applies this to a choice of model for $X$. i.e., a scheme $\mathcal{X}$ over $\mathbb{Z}$ whose generic fibre is isomorphic to $X$.