Yes and no.
As worms crawl through the soil, they ingest soil, in other words, they take it in their mouths and it passes through their gut and comes out the back like poo would.
But they do not eat the soil, just use some of the organic stuff in the soil as food. Soil is the mineral particles of sand, silt, and clay, and cannot be digested.
But the soil particles get coated with the digestive juices and other stuff in the worm’s gut that acts a bit like glue, causing the soil particles to stick together after they come out the back end of the worm.
So, worms do not poo soil like you poo the food you eat. The take the soil into their mouths and it passes through their gut and comes out the back end. The sand, silt, and clay particles are not changed, but are coated with stuff from the worm’s insides that causes the soil particles to stick together.
Dr. Dirt has a great answer! One thing I’d add is that worm poo (also called “worm castings”) improve the soil for many plants. Because worm poo sticks together, it creates bigger grains of soil, with more space for air and water between them. These pockets of air help the plant roots breathe!