They diffuse through small pores at the bottom of the leaf called stomata.
Plants can open and close their stomata, they open them to get water and carbon dioxide in but then close them to ensure the water doesn't 'leak' back out. This is important for plants growing in drier conditions like the cactus.