Air conditioning not only cools the cabin of the car, it also removes moisture from the air, which is a useful tool during the demisting process.
The original gases used in the system were found to have a harmful effect on the atmosphere by depleting the ozone layer and have been phased out over time in favour of less damaging gases. The most common gases found today are termed R134a and the up to date type R1234YF.
Due to the toxic nature of these gases it is illegal to deliberately allow these gases to escape to the atmosphere and specialist equipment must be used for draining, testing and refilling.
Due to the high pressures in these systems leaks are very common. The gas also contains a special oil which not only lubricates components but keeps the seals supple and therefore gas tight.