Logically, it wasn't really much needed. Saruman was already defeated by the Ents. The people could have just evacuated instead of losing soldiers at Helms Deep. More to the point, if they'd retreated from Rohan toward Gondor, Saruman, assuming that the Ents didn't attack him, would have pretty much had nothing except the land and now he'd be stuck with three choices: 1.) Head toward Gondor and ally with Sauron (who already may have heard or suspected the double-cross, though maybe not, as neither Mordor orcs nor Isengard orcs ended up surviving the attack by Rohan (or infighting).) 2.) Head toward Gondor and ally with the Free People of the West 3.) Head toward Gondor and fight both Rohan, Gondor, and Mordor at once. (Not a good idea) Also, unless Gandalf believed that the Ent march, if he even knew about it, would be successful, Gandalf had to assume that, if his goal was to defeat Saruman, that, after fighting off the Orcs and the Dunlandings (why the heck did they join in this again?), that they'd STILL have to assault Isengard. Had Isengard not already been taken down by the Ents, the siege following the Battle of Helms Deep, even if won, would have ensured that they got to Gondor too late, and that Minas Tirith fell, which would mean the eventual fall of Gondor, and could have meant that they were in no position to assault the Black Gate, leading to Sauron's capture of the Ring Bearer and the Ring with him. It was NOT that they actually believed Saruman to be truly working for Mordor, because Gandalf knew of the double cross. As such, leaving Rohan and taking all the people toward Gondor would have been the better move. With Rohan and Gondor in the way of Sauron, Saruman didn't have to worry about Mordor beating down his door yet. If, however, he pursued Gandalf and the Rohirrim to Minas Tirith, Saruman would have come into sight of Osgilliath, which was under the control of Mordor. Granted, I'm not sure if Saruman would have even come himself, and orcs are unpredictable (they aren't Mordor friends, but orcs aren't generally the good guys), but it's possible that the Dunlandings would have sided with Rohan and Gondor rather than Mordor.