I was pretty sure that the story is from Starship Troopers, but upon reading it again, I realized it isn't. From what I remember, the main character (possibly an officer) is convicted and sent to a military prison somewhere in a desert. Here using his knowledge he manages to rally some of outcast prisoners. I distinctly remember 2 fragments:
One of the outcasts gets into a fight and the main character fights alongside him, so the next morning the both do their push-ups next to one another.
The guards split the prisoners into men and women and make them carry sand to build two piles. It was some kind of contest. The main character thinks if the prisoners had a leader he could make sure that the men slow down so both groups would finish in the same time.
Finally, due to the war going badly they get reinstated on a starship. I think the unit calls itself "Rats" and they have a inscriptions on their belt buckle reading something like "Touch me if you dare".
I think the enemy was called Arachnids, and this was one of several stories on the same theme. Also, I read it in Romanian, so it might not be a English story at all, and the quotes might not be accurate.
The book where this story is had a series of stories related to the same war, most of them unremarkable, the only thing I remember is that the first story was somehow related to merchants and a bar brawl. The stories didn't have common characters.
The story I'm looking for starts with the main character arriving at the prison camp, and ends when the prisoners are reinstated.