Nothing would prevent that; it is common. One term for this is to Lie Doggo and there are some examples referenced in the wiktionary article on the term. I'm not sure how one distinguishes "faking death" from "hiding".
Here is another example
The eminent neologistician has citation files from Prof. Allen Walker Read including this World War I Aemrican entry: "...sometimes the man isn't dead, but a perfectly live Boche patrol lying 'doggo'. [ R.D. Holmes, Yankee in Trenches (1918, 80 ] [ with a p. 210 Glossary entry: ] Doggo --- Still. Quiet. East Indian derivation." (Now, that's how to do a citation: Oll Korrect. (CQ O,K) It's a pleasure to deal with old pros.) Prof. Algeo guesses that the expression "may have been an Irishism that spread via the British army in India."
My father-in-law was separated from his unit during WWII and behind enemy lines for months; the result was a chest full of decorations. Before he made it back to his unit they were in the process of declaring him dead. He didn't "fake" his death, he simple was lost behind enemy lines.
Another example is going to be very common; a soldier is wounded and unconscious, but awakens before the dead are buried. This is not an example of "faking death", but fits some of OP's requirements.
OP's question imposes some very strange assumptions. "one of the armies starts to have a lot of casualties and starts to retreat" - I don't have a citation, but there is a West Point Study that shows that almost all armies will rout before they reach 40% casualties. Every time one side routs, the soldiers lose disciple and retreat in disorder from the battlefield. This will include some combination of running and hiding that is, as far as I can tell, no different from "faking one's death".
OP also suggests that the losing force may be on the verge of being surrounded; this would be unusual. Most armies will rout before they are surrounded - the times when one army is able to envelop another are studied as examples of brilliant leadership.
OP may be asking for a situation where someone does more than lie doggo, but employs active deception, perhaps coating oneself with blood from another wound. I don't have any sources to mind.
There is another term that would shed some light on this question - there is a prejorative word for people who scavenge the battlefield and loot the dead or nearly dead. One of the reasons that they are held in such contempt is that they have a reputation for "assisting" the wounded to die so that they can steal their worldly goods (and sometimes even their teeth). If I could remember that term, I might be able to search for examples that align with what OP wants.