In the book, Théoden is found shortly before his death, so this problem is side-stepped:
'Hail, King of the Mark!' [Théoden] said. 'Ride now to victory! Bid Éowyn farewell!' And so he died, and knew not that Éowyn lay near him. And those who stood by wept, crying: 'Théoden King! Théoden King!'
Yet [Éomer] himself wept as he spoke. 'Let his knights remain here,' he said; 'and bear his body in honour from the field, lest the battle ride over it! Yea, and all these other of the king's men that lie here.' And he looked at the slain, recalling their names. Then suddenly he beheld his sister Éowyn as she lay, and he knew her.
Return of the King Book V Chapter 6: "The Battle of the Pelennor Fields"
So this is purely a movie invention. Unfortunately I can't find this scene in the script, so we can only speculate.
The most plausible explanation is that Théoden was moved, but Éowyn left behind. Théoden was a king, after all, so the priority would have been to remove his body from the battlefield. If someone did that without recognizing Éowyn (which seems plausible, since nobody was expecting her to be there), she most likely would have been left behind.