Stomata are the structures through which gas exchange occurs in leaves. Each stoma is surrounded by two guard cells, which can open and close depending on environmental conditions. When moisture is plentiful, the guard cells swell with water, forcing the opening of the stoma open and allowing gas exchange to occur. When the plant loses too much water or water in the environment becomes less plentiful, the guard cells deflate, closing the stoma and preventing further water loss or gas exchange.
When the stomata are open, the plant can take in carbon dioxide from the air for photosynthesis and release oxygen (a byproduct of photosynthesis) back into the environment. While doing so, the plant also loses an enormous amount of water by evaporation. This process is called transpiration. To make up for this water loss, additional water is drawn in from the soil by the roots and passed upward through the plant by the xylem.