If a superior says, "Secure that village," you do not get to ask, "Why?"
If a superior says, "Kill all the civilians living in that village," you do get to say, "I refuse," report the criminal act and/or possibly face a Court Martial for disobeying an order.
If a superior says, "Deploy to Iraq," but you don't like the reason for the mission, you have every right to refuse ... but you must also be willing to accept the legal consequences.
The military is the sharp edge of diplomacy. When other diplomatic efforts fail, the military is deployed. The military does not get to choose which actions they will participate in based on their political beliefs.
So, the general rule is "Choose wisely which issues you are willing to fall on your sword over." Failure to obey an order in the military can result in massive loss of American and allied lives. Often, it's better to follow the order, then report any truly illegal orders to your chain of command.
Being told to deploy to another county for any reason is not "refusing to follow an illegal order." You are not at the level necessary to judge whether or not the decision to deploy forces on foreign soil is legal.