How would you have 1 soldier model and then change the weapon depending on what class is chosen without having to load all the weapons at once and without having to load a new soldier for every weapon?
You make a single soldier model. You make a number of weapons.
Then you would use something oft called a "hard point" (or "attach point" or many other things). You set such a point on the model's hand. You set another such point on the gun's grip. Now you can programmatically look up these points in the model data and mount the gun's grip in the soldier's hand (using either "model parenting" if you support such or just setting the world position of the gun appropriately). Because the soldier's hard point should be attached to a bone, the gun will stay in the soldier's hand during animation. You can now swap out the gun at will and place whichever gun you want in the soldier's hand with no additional work.
You may also have some animation data for the soldier to control when the hand is in a "hold a pistol" state or both arms and hands are in a "hold a rifle" state or the soldier is holding nothing and is in an "unarmed" state. You can blend these animation states with the other animations being used, or make a set of animations (running, idling, etc.) for each general class of gun. The complexity of the animations and desired level of realism/fidelity will determine how far you must go here.
You can go another step and programmatically animate the soldier model to the gun's dimensions using the hard points to determine where the hands should be placed and what general state they should be in so that the soldier smoothly works with any of a very wide variety of accurately modeled guns (not all rifles are held the same way). This is not the easiest thing to do by any stretch but is required if you want a very realistic game or have a very wide variety of gun types.