There's a couple of ways of doing it:
Castration , or if you're from a slightly more backwards planet they might just slam the family jewels between a couple of half-bricks and the 22nd Squeaky Man Division is born instead of the 22nd Rampant Fornicators and Childcare facility. Problem with altering nuts is there's less testosterone and when there's less testosterone, you're less likely to butcher the living **** out of your fellow heretical man, xenos or each other. Diddling womens bits to not-work is slightly more difficult and figure if they're being that randy, the Dept Munitorium will roster them off to 'Colony Training' where they can f**k, bake bread, fight and breed all they want.
Just being in the Army . For those of you who are unfortunate enough to know what that is, basically at any point the soldiers even look mildly relaxed someone will decide that you need to run 20-30km with full kit or some other horrible, physical activity to the point that at the end of the day, lifting a fork in a mess tin becomes a sheer act of will. The thought of jumping up and down on anyone with any kind of vigor is even less. Plus there's the other great military tradition, which has mostly fallen out of contemporary armies in favour of the above practice and that is 'Aggressive Aversion Therapy'. Also known as corporal punishiment and in the case of the Imperial Guard, plenty of capital punishment!
Dropped a las gun charge pack and lost it?- Thats a beating!
Forget to bring enough ammo and ran out in a battle?- Thats a beating!
Modified your weapon without permission?- Thats a beating and after we've finished beating you, you'll be shot
Left wargear on the battlefield and didn't retreive it? You get shot
Didn't salute an officer?- Thats a beating, 90days solitary and another beating when you get out
Traded your lamp pack for a roll in the hay with one of the natives?- you get shot
Basically the Imperial Guard will beat the f**king crap out of your miserable hide for what we in the nice, politically correct era we're in, would consider only trivial offences or offences that aren't your fault and part of the mechanism. Applied fairly, this kind of enforcement does actually work to some degree, the ramifications of too much or too little I'll leave to your own research. But for the game purposes, the IG is a horrible, **** place to work even when you're not expected to kill a carnifex with a flashlight and very nearly as dangerous.
Dey put stuff in da grub? Playing on an old soldiers tale that they put Bromine in the rat-packs to make you want to screw things less, might actually be true in 40K where the Dept Munitorium supplies all your vitals and needs. They also decide what you do/don't need! If they decide you don't need to be dipping your wick in your fellow soldiers, they're perfectly in their rights to never give you an erection about anything, ever because they do actually own you like a piece of meat. Of course if the force gets lost in some alien wilderness for 100 years and they run out of normal food and go native, breed and create a new society when they're next discovered. Well its just a bonus really that there's more warm bodies to tithe and send off to the next war!