The film's canon novelisation indicates that Luke heard sounds of battle after the final transport (and the X-Wings carrying the remaining pilots) left the planet.
Given that Luke's ship was the last to leave and given that the soldiers had no capacity to leave the planet and no incentive to surrender, I think we can reasonably assume that any that were left behind fought valiantly to the death, knowing that every shot fired was a hammer-blow against the hated Empire.
Then, overhead, you see it: Han’s rickety old ship, still supposedly
“the fastest in the galaxy,” shoots out of the south hangar and climbs
up through the atmosphere. You smile. At least Han got out. Hopefully
the princess, too. Yes. She’s in that ship. You can tell.
And then an explosion presses you into the ground. A wave of heat
courses over your body. You are lying on your back, the snow rapidly
melting around you, fire licking your chest. Then it subsides. You
raise the blackened visor of your helmet. The snow walker is dangling
from its own legs, a blackened husk. You get up and run.
On a remote part of the ice field, far away from the battle and the
now-ruined rebel base, you trudge through the snow. A short distance
farther sits your X-wing, a spaceship outfitted for one pilot and one
droid. R2 is in his place. He’s the one who piloted it out here to the
muster site, to wait for you. The last of the other pilots are taking
off, leaving a strange sight: a spaceship, small and lonesome, sitting
on the edge of a frozen wilderness. The sounds of battle seem very
distant out here.
The Empire Strikes Back: So You Want to be a Jedi
The older junior novel mentions the soldiers being ordered to abandon their positions and flee for the remaining transport/s. It's certainly possible that some were successful.
Back in the trenches, the situation had become dire.
“Begin retreat!” shouted the Rebel trench officer.
A second officer commanded, “Fall back! Fall back!”
The troops responded, fleeing from the battle as the snow-covered ground exploded around them. The Imperial walkers fired their lasers at the running Rebels, continuing their advance toward Echo Base.
Star Wars Episode V: The Empire Strikes Back (junior novelization)
The original novelisation confirms the withdrawal of the troops (from their positions) but makes no mention of their success.
He tried to stand, but fell back against the snow, hoping he would not
be spotted by any of the walker pilots. His comlink whistled, and
somehow he found the strength to flick on its receiver.
“Forward units” withdrawal complete,” the broadcast voice reported.
Withdrawal? Luke thought a moment. Then Leia and the others must have
escaped! Luke suddenly felt that all the fighting and the deaths of
loyal Rebel personnel had not been for nothing. A warmth rushed
through his body, and he gathered his strength to rise and begin
making the long trek back toward a distant formation of ice.
Star Wars Episode V: The Empire Strikes Back - Official Novelisation
Interestingly, the Radio Drama puts a rather more hopeful spin on things. The evac groups were successful in pulling back and the destruction of the main tunnel slowed down the Imperials sufficiently that the final transport was able to leave with all remaining (e.g. living) Rebel troops on it.
WEDGE: This is the last evacuation group.
LUKE: You should be gone already. How come you're still hanging around?
WEDGE: Well, we sort of got delayed—a little of this, a little of that, while we were, uh—
LUKE: While you were waiting for me. Thanks, boys. What about the base?
WEDGE: The stormtroopers are already inside. Everybody who still could, got clear.
The Empire Strikes Back: Radio Drama