The opening and closing of stomata regulate transpiration by controlling the rate of water vapor loss from leaves. Stomata open in the presence of light, allowing for gaseous exchange and transpiration, while they close in response to factors like darkness, high temperatures, or water stress, reducing water loss.