The muscles in your shoulder and upper body have enough power and stamina to do this for hours without getting fatigued, so use them! Moving your wrist and fingers is just to "pick off the right notes" as your whole arm moves "in a circle" for each group of four octaves.
How do you play octaves without wrist pain?
Try playing an octave with the right hand and holding it down. Relax enough so that the friction between the fingers and the keys holds the hand open. You should be able to maintain this position for as long as you need, and it should give you no discomfort.