Imagine that every Jew in Israel decides to become observant. Also imagine that no soldiers are forced to work on shabbat; it is completely optional. Since the army saves lives, would Halacha say to work on shabbat in this case or not?
The argument I see for choosing not to work is that marginally, a soldier in the army does very little. In an army of 100,000 people, it would be hard for any individual to justify why they need to work. It is not as if one soldier taking shabbat off will be a threat to the security of the country.
But the argument I see for choosing to work is that if everyone thought that they weren’t needed and decided to take shabbat off, it would be a very big problem and lives would be in danger. So as a collective, the soldiers are needed.
You can ask the same question about other jobs, like medical workers, I am just using the army as an example.