Alternating 4th and 5th is done so that the octaves can be played "semi-legato." Obviously, you can't play a whole scale legato this way, as there are adjacent white notes that will be fingered 5 -> 5.
To play octaves completely legato, you need to pass the fourth finger "through" the fifth finger while holding down the top note. To do this, play a note with your fifth finger, and then add your fourth finger to the held key and remove your fifth finger. This leaves your fifth free to play another note. You can play octaves legato this way, though this is something of an illusion since there is no good way to hold the bottom notes of the octave. This is a handy organ technique that's useful at the piano
Another reason for alternating 4 and 5 is to force proper wrist technique in octave runs. In fast octave runs, economy of motion is key, you can't be making huge arcs between each octave. Using 4 on black keys forces you to think "across" rather than "bouncing up and down." This kind of technique is called "impulse playing." To practice these kinds of octave runs, play the first octave and then successively add one more octave in each repetition. First you play one, then two, then three etc... This kind of practice should be done at top speed.
As an aside, I hope you're not thinking of playing the Erlkonig. It's a brutal piece. Even the best pianists cheat. If your technique isn't perfect, it's a piece you can give yourself a repetitive motion injury by playing.
As an aside to my aside, if you decide to play the erlkonig. Here are some clever ways of making the octaves easier.
Drop the bottom note of the octaves and play 3-2-1. Only when musically appropriate. (Not in the big sections!)
Another good trick is to jump up with the left hand and play the first octave of every triplet as only the bottom note of that octave. Using the left hand of course. This actually produces a wonderful musical effect that even more closely resembles a galloping horse than the original octave figuration.
Octaves are hard! Good luck!