No, not all plants do this. Most plants indeed need sunlight for photosynthesis and for releasing oxygen. However, some plants can produce oxygen even without the sun present. The snake plant is one type of plant that releases oxygen at night and during winter months when the sun is not present.