There are various theories that had been proposed regarding the opening and closing of stomata.
But the most accepted theory is based on movement of water in and out of the guard cells. When water moves inside the cell, guard cells swells and become turgid which facilitates the opening of the stomata. Similarly when water moves out of the cell, the cell becomes turgid which promotes the closing of the stomata. This occurs due to difference in solute concentration.