The main responsibilities of stomata, tiny openings on the bottoms of plant leaves, is the intake of carbon dioxide and the release of oxygen. These are necessary for photosynthesis to take place, since this process uses carbon dioxide and produces oxygen as a waste product.
Stomata are necessary, but they are also a problem for plants because, while they are open to allow gas exchange, water vapor escapes as well. Plants need water for photosynthesis and other biological processes. On hot, dry days, stomata can close to help the plant conserve water. Often stomata open to begin photosynthesis, and begin to close after noon during the hottest part of the day. They also close at night, since no photosynthesis is possible.
Two sausage-shaped guard cells control whether stomata are open or closed. These cells control their shape based on how much water they contain. When very full of water, they curve outward, opening the stomata wide. When they lose water, they begin to straighten and close off the holes. This allows for an automatic response when the leaf as a whole begins dessicating. They are also responsive to carbon dioxide levels, however, and lower levels cause them to fill with water and open the stomata wider.