Yes whales do poop.
When a whale release its excrement the whales poop comes out as an almost liquid form of fecal matter (often in a plum like cloud) and is light enough that it does not sink but floats across the top of the ocean.
If a whale needs to poop it has to travel to the surface of the water to relieve itself.
And when a whale takes a dive it shuts down its none crucial biological functions so that it can focus on other activities.
One of these non crucial functions is the ability to poop which explains why whales only poop at or near the surface of the water.
Since whales must come to the surface for oxygen they are likely to visit the surface frequently enough to relieve themselves whenever they need to.
Research has found that a whales poop is extremely earth-friendly and necessary for a healthy environment.
In fact whale poop is very important for the ecosystem and various forms of marine life such as phytoplankton.
The nutrient rich fecal matter feeds phytoplankton (plants) which allows it to grow and prosper.
As the phytoplankton grows it pulls more and more carbon dioxide from the atmosphere cleaning up the environment and creating a healthier eco system for both land and oceanic animals.
The carbon that gets pulled from the environment stays trapped inside the phytoplankton for as long as it lives which could be for several millennium.
An unfortunate side effect caused by the whaling industry (other than causing many species to become endangered) is a huge loss in nutrient rich whale fecal matter due to the slaughter of hundreds of thousands of whales which would have aided the ecosystem greatly in terms of the growth of phytoplankton and the reduction of carbon dioxide in our environment.
In fact the large decrease of whale poop and phytoplankton have led some individuals to debate the concerns regarding the effect this is having on the reduction of clean oxygen in our environment.