The whole idea of Replicators and Transporters is that they have some technology which can efficiently convert matter and energy, so it’s possible that they use some sort of reverse-replicator to process waste.
You also never see what they do with the glass cups the replicators create when someone asks for a drink…