Firstly the water potential of the xylem vessel in the leaves is much higher(less negative) than that of the mesophyll cells. Hence water moves down this water potential gradient by osmosis via the apoplast and symplast pathways into the mesophyll cells.
This water then replaces the thin layer of moisture around the mesophyll cells which allow diffusion of gases to take place. This is because the moisture gets evaporated to water vapour in the intermolecular air spaces which then move down the water potential gradient to the atmosphere via the stomata.
The atmosphere has a much lower water potential gradient that the intermolecular air spaces within the leaves.
However this occurs only during the day when the stomata are open.
If you need further explanation........feel free to ask