When stomata are open, carbon dioxide enters the plant through stomata. Carbon dioxide is necessary for the process of photosynthesis in which it is converted together with water into oxygen and glucose. For most plants, it is necessary that stomata are opened during the day when there is a lot of Sunlight also necessary for the process of photosynthesis.
However, some plants from the arid locations have stomata closed during the day, so they reduce water loss that way. In the night when is colder, stomata open and carbon dioxide enters through stomata.