They get to choose Air, Law or Ground when they go in. Air contract must pass a flight physical. Law contracts must have completed their JD or be accepted into a program. If they pick ground they, depending on gender, can end up in anyother MOS.
After OCS all officers must complete infantry type training at The Basic School also in Quantico. When I was with E&I Co, I think it combat instructor company now, we would run them through familarization on some crew served weapons and act as aggressors when they were doing there field training. there's some more to it than that, but that's the idea of it. If it's still the same as when I was there the Lts will qual on the rifle and pistol range while they are at TBS.
While at TBS the classes our broken down into 3rds based on grades and the top of those 3rds are more likely to get the MOS they want. They do this to ensure that no one MOS gets all the good officers while MOSs, like supply, get a bunch of dumbasses. If a male officer gets infantry they stay in Quantico and complete IOC for their MOS training. I have no idea about where other MOSs go.