A couple of points here. First of all, in Starship Troopers going into 'federal service' didn't necessarily mean that you went into the military. The book makes it clear that there were other forms of federal service, although they weren't ever really explored in the story. I seem to recall that early in the book Rico (the hero) has an encounter with a medical doctor who's doing federal service and when Rico asks him if he's in the military, the doctor says something like “Heavens no, I'd never go into the military. You'd have to be crazy to want to do that.” Basically when you go to apply to do federal service, they offer you a job (or choice of several jobs) based on what you were qualified to do. If you couldn't stand the thought of doing any of them, you could simply chose to not do your federal service. The main character, Rico, was a recent high school graduate who had gotten terrible grades, so the military was basically the only option open to him.
That being said, the society in Starship Troopers wasn't supposed to be some sort of perfect liberal democracy that respected people's rights. According to the story there had been some sort of near-total societal collapse some time in the past, and the new order was only really concerned with ensuring order and stability.
The idea was that people who had performed federal service had demonstrated that they really cared about society functioning properly, so they were more likely to carefully examine issues and make thoughtful decisions when voting, unlike the majority of people who didn't really care about political issues and were likely to make poorly-informed or frivolous choices. It's also suggested that people will take their right to vote more seriously if they have to earn it rather than simply having it handed to them. I have to admit that both points seem to make sense.