The Kamayani Express was on its way to Mumbai when it derailed late Tuesday night near the town of Harda in Madhya Pradesh state, while the Janata Express was traveling in the opposite direction when it derailed soon after.
The trains were crossing a bridge over the rain-swollen Machak River, about 950 kilometers (590 miles) south of New Delhi, where flash floods had collapsed tracks, said railway official Anil Saksena.
Six coaches from the Kamayani Express and the engine and four coaches from the Janata Express had derailed.
At least two coaches had been partially submerged in the river, Saksena said. While most people had been pulled to safety, rescue workers were still searching for passengers likely trapped.
At least 24 bodies have been recovered so far and one person was seriously injured, said Bijendra Kumar, a railway official in Bhopal, the main city in Madhya Pradesh state.
Junior Home Minister Kiren Rijiju said at least 250 people have been rescued.
Saksena said that by Wednesday morning, the unaffected coaches had been moved from the tracks.
Rescue operations were nearing a close, according to Kumar, and railway workers would soon start repairing the tracks so traffic can resume. Dozens of trains have been blocked from moving due to the accident.
The rain eased Wednesday following two days of heavy downpour.
India has one of the world's largest railway networks, but many parts of it are poorly maintained and accidents are common.
China to speed up bullet trains in September: state media