When an electron goes thru the first SG apparatus, it's spin is prepared. Suppose it's the spin state that has higher energy level with respect to the magnetic field. When it goes through a second SG apparatus, its spin will be confirmed. But why won't it spontaneously emit an photon and flip to the other spin state?
The Stern-Gerlach experiment should best be understood semiclassically: the translational motion is classical and the spin motion is quantum. Here, the implicit assumption is that the scale on which the magnetic field varies is much larger than the scale of the electronic wave function. Hence, the magnetic field gradient, which influences the translational motion, is small, and the translational motion does not induce any spin flips. If you were to use a magnet with a really sharp magnetic field gradient, then you can indeed flip spins.