Decreasing temperature increases the solubility of a gas in a liquid, while increasing the temperature decreases solubility. Since sodas are made by dissolving carbon dioxide in a liquid, increasing the temperature of the soda decreases its carbonation.
Sodas are carbonated under high pressure by dissolving carbon dioxide in water or corn syrup. The carbon dioxide dissolves until the pressure of the liquid equals the pressure of the surrounding air. Packaging sodas under high pressure ensures that an increased amount of carbon dioxide is dissolved in them. Conditions allowing the expansion of the dissolved gas lead to a decrease in carbonation.
Heat causes the carbon dioxide in sodas to expand. When the temperature of any substance is increased, the molecules within that substance gain energy and move more rapidly. In soda, the dissolved carbon dioxide molecules move faster and escape the liquid more rapidly (commonly observed as an expansion). This causes a decrease in the carbonation of the soda, assuming that the pressure of its contents does not change.
Likewise, when the temperature of the soda is decreased, the molecules of carbon dioxide move slower and are less likely to escape the liquid. Therefore, a cold soda retains its carbonation longer than a warm soda.