Like many other animals, you breathe through your nose and mouth. Plants, by contrast, breathe through tiny pores called stomata on the underside of their leaves. These pores allow carbon dioxide to enter and oxygen to exit. Plants open and close their stomata in response to changes in their environment so they can get the CO2 they need, and avoid drying out.
TL;DR (Too Long; Didn't Read)
Plants breathe through tiny pores called stomata on the underside of their leaves, which are surrounded by a pair of guard cells that expand or contract depending on environmental conditions, allowing more or less gas to flow in and out of the pores. Plants need CO2 to enter and O2 to exit. Stomata close when it is dark and dry, unless carbon dioxide levels inside the leaf start to fall.
Three different environmental factors affect the opening and closing of a plant stoma: light, water and carbon dioxide concentrations. Plant stomata close in darkness and when conditions are very dry. Since plant cells need carbon dioxide for photosynthesis, carbon dioxide concentrations are another key factor. If carbon dioxide concentrations inside the leaf start to fall, the plant will open its stomata so that more CO2 can enter, even under dry conditions when the stomata would ordinarily be closed.
Each stomatal pore is surrounded by a pair of guard cells shaped like tiny sausages. Guard cells can expand by pumping ions across their membranes. As the ion concentration inside the guard cell rises, water starts to flow into the cell and it swells until it starts to bend into a semi-circle, so that the two guard cells together look like a letter O. The opening between them is the stomatal pore, and gases flow in or out through this opening. If the guard cell pumps ions back out, by contrast, water starts to flow out of it, and the guard cell shrinks until it looks like a letter I. Now the two guard cells are parallel and adjacent again, so the stomatal pore is closed.
Carbon Dioxide Sensing
Falling carbon dioxide concentrations trigger a biochemical pathway that makes the stomata reopen. Not all of the components of this biochemical pathway have been identified yet, but the most important players are potassium and chloride transporters. These proteins pump positively charged potassium and negatively charged chloride ions across cell membranes, driving the change in ion concentration that causes the guard cells to either shrink or swell.
A number of genes that seem to be essential for response to changing CO2 levels have been identified, and scientists are still working to figure out how falling CO2 activates the potassium and chloride ion transporters. Scientists should be able to breed or engineer better-yielding crops when they understand this mechanism in more detail.