The ruling gave polluting industries until June 30 next year to install treatment plants, court officials said.
Bangladesh passed a law in 1995 making it compulsory for all industrial units to use effluent treatment plants in a bid to combat river pollution, but the rules remain widely flouted.
The law followed a series of media reports that the once mighty Buriganga river, which flows by the capital Dhaka, has been seriously polluted by rampant dumping of industrial waste.
Bangladesh has about 230 small and large rivers, and a large chunk of the country's 150 million people depend on them for a living and for transport. But experts say many of them are drying up or are choked because of pollution and encroachment.
A World Bank study said four major rivers near Dhaka -- the Buriganga, Shitalakhya, Turag and Balu -- receive 1.5 million cubic metres of waste water every day from 7,000 industrial units in surrounding areas and another 0.5 million cubic metres from other sources.