What happen to the 02 gas after photosynthesis has occurred?

Leaves have holes in them for two reasons. One is to take CO2 in. The other reason is to let O2 out. These holes are on the underside of the leaves, and are called stoma. When these holes open, O2 is released into the air. That's why it's said that plants produce oxygen, because it is a waste product from photosynthesis and is released through the stoma.