The stomata of most plants open during the day to allow carbon dioxide to be absorbed by the plant. When the stomata open water evaporates through the stomata, a process that is known as transpiration. Many plants that are adapted to arid conditions close their stomata during the day and open them at night. This prevents water loss via transpiration.
Pineapple plant practice Crassulacean acid metabolism (CAM) as an adaptation towards the arid conditions.
As an adaptation, they shut down their stomata during the day time and open at night time to collect carbon dioxide.
The closing of stomata during the day time reduces the loss of water through transpiration that is, the loss of water in the form of water vapours through stomata.
Then the species would either go extinct if it is a drastic change, or they would adapt to their surroundings, and pass on their adaptations to their offspring. Survival of the Fittest.