"Climate change is like a fever" that must be fought, he told a conference in Madrid, saying he was deeply concerned about the US withdrawal.
"I think President Trump is standing on the wrong side of history."
Trump announced on June 1 that the US would not abide by the 2015 Paris agreement, signed by 195 countries to reduce carbon emissions.
Ban, who stepped down as UN boss at the end of last year to make way for Antonio Guterres, pushed hard throughout his mandate for action to fight climate change. He has said he will continue his efforts among civil society.