This happens in a fraction of a second. The time is too short for the dilated pupils to contract back. The red eye caught in the photographs is the red glow of the blood flowing through the retina. The flash illuminates the reddish retina at the back of the eye. In modern flash cameras, corrections are built in to avoid these dreaded red eyes.
Some cameras avoid red eye effects by using the pre-flash function of many flashes.
Several preliminary flashes are first emitted so that the pupils close down before the actual photo is taken. This tones down the effect. Digital cameras have separate provision in the software so that the red eyes are eliminated.