It is currently not known what causes thunder. In the 19th century it was believed that thunder was an explosion of steam caused when water heated up along the lighting. In the 20th century it was believed that the sudden thermal expansion of the plasma caused a shockwave similiar to that of a supersonic airplane. What this means is that when the heat produced by the lighting which turns air into plasma along the channel of the lighting causing the gases to expand causing the cooler air to be pushed outward creating a shockwave effect. This consensus has however been eroded and new proposals deal with the electrodynamic effect of plasma.
http://weathereye.kgan.com/cadet/lightning/thunder.html