In order to train soldiers for invading or defending you will need to build a barracks on a planet.
The barracks requires a light weapons factory to be built first.
Once built a link becomes active on that planet to go to the barracks screen.
Soldiers are used to invade hostile planets during the game. Soldiers are also protecting your own planets from Invasion.