Coming from you, I'm a bit surprised. First, and simplest, the government doing it is "right" because we say it is right. More complex, someone simply coming here and working for their own benefit is vastly different than coming here, enlisting, and doing their duty to represent and protect our republic, before working for their own benefit. Maybe you see the military as the same as an employer, I do not.
Really I'm surprised that you are tribal about this. If someone wants to join our military and follow through with that entails, I don't much care where they came from, and I would welcome them to stay. Now before anyone jumps on this, obviously there are still measures in place to stop Jihadi Jabar from assassinating our own, and obviously those measures fail from time to time, even within our own "tribe". I'm not calling for open casting calls to all the world, simply allowing those who are living here to join the military rather than be deported.