Spinning wheels have gyroscopic effects. Whipping the bike can be a way to reposition the bike so that when it comes out of the whip, it is in an orientation that wouldn't be possible going over the jump dead-straight. This effect is large in the case of motocross.
From a BMX perspective, it is very important to land on the backside of the landing ramp with the proper bend in your legs so that you can get the maximum "pump" off the landing. In some cases, especially in the case of a short landing ramp, it can be advantageous to do a slight whip and therefore land with the bike at an angle. This can get you more pump than landing perfectly straight. If you watch people negotiate a street spine, for example, you will see that it's downright awkward to go straight over without doing a whip.
Also, there's often a corner and a berm shortly after a jump, so a slight whip can set you up for what comes next, vs. landing perfectly straight then having to muscle the upcoming corner.