When soda freezes, the newly formed ice expands, and carbon dioxide gas forms enough pressure to shatter the aluminum can or glass bottle in which it is contained. Soda expands as it freezes, and should be in a container that is capable of withstanding this expansion.
Carbon dioxide forms in the soda and is expelled as it freezes. The crystallizing water does not admit any of the carbon dioxide molecules, so the expelled gas takes on increased levels of pressure.
In some cases, an aluminum can has the capacity to explode if the pressure exploits a flaw in the metal. In other cases, the gas erupts when a person opens the tab on the can. Whether the container is aluminum or glass, the force of liquid expansion causes the container to burst.