As Apollo says its just the psychological shock, which very much depends on the situation. The soldier on guard duty is not expecting to be shot, hence the surprise.
However, if two combatants come face to face (say in cqb) and each fire, both are expecting to be hit and it just becomes luck and instinct. In which case fight or fight takes over. It is not uncommon for soldiers to be seriously/critically wounded and not realize, until that shot of adrenaline wears off, a few seconds after the fire fight concludes.
It's analogous to being in a bar fight. You don't feel the pain until later