Soldiers can be recruited the same way all other crew roles (except Outlaw) can by completing procedurally-generated NPC quests, which will give the quest giver a chance to turn into a recruit-able crew member with a 1/7 base chance to choose Soldier class. However, there are a few ways to increase the chance for an NPC to become a soldier:
If a friendly NPC or a Tenant is an Apex Rebel, they have a slightly higher chance to become a Soldier (25%) compared to other NPCs (14.3%).
Soldiers provide no benefit when left on the ship. Instead, soldiers are naturally trained in professional combat, allowing them to use 2-handed weapons. Whereas most other crew roles use Pistols and Shortswords/Daggers to fight, Soldiers prefer to use Assault Rifles and Broadswords.
Because of this, Soldiers are able to have noticeably improved performance in combat compared to most other crew roles. The rapid-fire nature of their assault rifles makes it less punishing if a soldier misses a shot. Additionally, while all NPCs are able to lunge with melee weapons as a part of their AI, the extra range of broadswords compared to one-handed weapons makes it much easier for soldiers to land a hit from a lunge. These benefits allow soldiers to be a noticeable threat while on the field of battle, and are more likely to fend off attackers without player intervention.
Despite their noticeable advantages in combat, Soldiers retain the basic AI used by every NPC, meaning they are hindered by flaws commonly found in the AI. Just like other friendly and hostile NPC units, Soldiers cannot swing broadswords as quickly as players, and cannot use combo attacks featured on most broadswords. Additionally, when using their assault rifles, Soldiers freeze their aim when firing their weapon, making it incredibly easy for them to miss their shots.
Overall, Soldiers are the best crew members to bring on your adventures if you want a sidekick that can pose a serious threat to enemies. However, while their improved combat abilities give them a sizeable advantage compared to other crew members, their AI flaws mean that their overall combat support is limited. Because of this, some players may prefer to have an orange Chemist tag along instead of a Soldier in order to buff the player's damage output at the cost of a weaker crew member.