Not to be confused with a roll bar or roll cage, which protect a vehicle's occupants in the event of a roll, and anti-roll bar tries to prevent rolling and loss of traction in the first place.
As a vehicle is turned into a corner, the centrifugal force tries to pull it outwards from the center of the corner. Since the bottom of the car (the tyres) are attached to the road, they travel in the expected direction (assuming no skid occurs).
The top of the car is therefore pulled outwards, and because of the give in the suspension, this causes the car to roll towards the outside of the corner. What happens next is that the inside wheel lifts off the ground, traction is lost, and the car skids.
The anti-roll bar is applied between the two wheels on opposite sides of the car, and effectively causes the suspension to have some effect on both sides of the car. If the offside suspension is compressed by external means, the nearside will also be slightly compressed, but by the bar - and vice versa.
If we now look at our previous example; the car enters the corner and the force pulls the top of the car outwards. At this point, before traction is lost, the anti-roll bar starts the pull the suspension down on the inside of the bend. The vehicle is lowered towards the ground becoming more stable, and a skid is avoided.