While it may seem redundant to say, most indoor bikes do not move. Please, stop and think about that for a moment. We are not talking about forward motion or distance, of course an indoor bike does not move forward. But what about the other motions that are involved in cycling.
When a rider is out of the saddle, most riders sway the bike from side to side a bit. Why does this happen? Generally, it is the mechanical reality of the situation due to applying extreme power to each pedal. Since the pedals are not on the centerline of the bike, applying a large force to the right pedal will, physically speaking, apply a rotational force that pushes the top of the bike to the right and the bottom of the bike to the left. Without this counterbalancing motion, the wheel would kick out to the side. By swaying the bike in the opposite direction, the amount of force that can be applied to the pedals is increased without crashing.
The second primary aspect of swaying the bike is that it allows the rider to engage their upper body (especially core and arms) into the movement which increases power.
Take a moment and watch some of the pros race, they only have about a 12 degree sway; less than most avid riders. This is due to their efficiency and power.
The last aspect of swaying the bike is that it allows the rider to more thoroughly align their biomechanics with the work that is being done. By tilting the bike, the rider is able to keep the leg that is driving down with a majority of the force in alignment lessoning the outward lateral stress on the joints.
With the exception of a few new bikes on the market, most indoor bikes do not provide movement side-to-side, and none of them replicate the true motion of an outdoor bicycle. Because of this limitation, instructors must emphasize relaxation when riding and allow gentle upper-body movement. Attempting to maintain a still upper body can place the spine and surrounding muscles at risk from the forces being generated by the legs.
I hope this helps, Joey