Barrels were chosen to store wine simply for the fact that they were used as all-purpose contaners in the past, and oak, being a tight grained wood, was capable of making leak proof barrels. The shape of the barrel made it extremely stong and once on its side, it could be moved by rolling.
A key difference in how an oak barrel effects the flavor of wine depends on whether or not the barrel is made of French or American oak.
The relatively wide-grained American oak imparts a much stronger flavor, with more obvious sweet vanilla flavors and spicy notes. French oak has a more subtle, slightly more savoury effect.
Generally, for red wines, barrels often add a little spice, enhance the structure, and may add some sweet vanillin characters. A white wine that has been fermented and aged in barrels will often have a noticeable nutty, buttery character along with the spice and vanilla characteristics that reds often pick up. Barrel aged wines are generally a little more complex and have a more interesting texture than those aged in a tank.