In phrases such as 'swear like a trooper' and 'lie like a trooper', the person referred to is certainly an infantryman. However, I suspect that 'work like a troUper' - which is sometimes also spelt 'troOper' - is a reference to actors/dancers...members of a troupe, in other words. In past times, such companies used to travel the country putting on plays, shows etc. They would frequently not have enough personnel to cover all the parts and jobs, so any one member might be a director, a stage-erector, a scene-shifter, Hamlet, a ship's captain (or whatever) within the play etc all in one evening. I'm not suggesting that soldiers aren't busy, but not quite SO busy, perhaps.