The baffles in the tank are there to prevent the water from rushing from one part of the tank to the other under cornering or braking/acceleration forces.
The diagram isn't wonderful. It only mentions cornering forces. The same is true for braking and acceleration forces. In a real tank, the baffles go both lengthways and sideways. NWH's description of the internals is perfect.
The red dot is roughly where the centre of gravity would be. You'll notice that in the unbaffled tank, it's considerably shifted whereas for the baffled tank it hardly moves at all.

The problem is that the centre of gravity moves around. If you remember your high school physics, the centre of gravity always wants to move in a straight line. This is Newton's first law. When the centre of gravity keeps on moving, the whole vehicle has to wobble in order for the centre of gravity to continue in the same line!
It might seem like quite a small effect, but as the water sloshes about, it can set up very dangerous wobbles very quickly. If you are driving close to the edge (for example, if you have to swerve violently to miss a child running into the road), this sloshing can send you over the edge without any warning.
Of course, even under normal gentle driving, you are constantly changing speed and direction. If you had an unbaffled tank the C of G would be moving forwards and backwards as well as side to side. The effect would be to change the speed of the vehicle as well as make it wobble from side to side.
Here's a similar situation that you will easily understand - imagine carrying a tray with lots of pint glasses each filled nearly to the brim with your favourite beer. You could probably balance it on one hand like a waiter in a fancy restaurant and walk round with it. Now imagine trying to do the same if you had a washing up bowl full of beer. You couldn't carry it without spilling lots of the precious stuff.
The physics is the same.
You will easily understand that all liquid-carrying tankers have the same problems. What may not be so obvious is that bulk powder carriers also have similar problems as powders can behave very much like liquids under certain conditions. Also trucks carrying meat carcasses have to be driven very carefully as the carcasses can swing from side to side as well as back and forth and cause a very similar rocking effect - although not as pronounced.
Yeah! Physics is FUN!
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
P.S. You'll notice that there are small gaps at the bottom of the baffles. They are
large enough to allow the sections to all drain properly as the tank slowly empties, but small enough so the liquid cannot rush from one section to another quickly.