Plants produce sugar and oxygen in a process called photosynthesis, by using sunlight, water, and carbon dioxide. ... In a two-step process, plants obtain chemical energy from sunlight. The collected energy is used in a second reaction to produce the sugar glucose