Customs officials said hospital waste was discovered in many of the 263 containers imported by a private firm.
The shipment was meant to be made up of used mattresses, carpets and rugs for potential recycling.
Most of the containers have been stored in warehouses, with only a small amount of material having been re-exported.
Legal action was taken after the Sri Lanka authorities impounded the material in 2018.
Officials said the 21 containers had left Sri Lanka on Saturday.
Customs spokesman Sunil Jayaratne said the original importation breached international and EU rules and regulations on hazardous waste and its disposal.
England's Environment Agency said it was committed to tackling illegal waste exports.
An EA spokesperson said: "We are in contact with the Sri Lankan authorities and have requested more information which would allow us to launch a formal investigation."
Several other countries in the region have recently begun to return waste imported from foreign countries.