A U.S. appeals court upheld a federal law that bars migrants who are in the United States illegally from possessing guns, rejecting arguments by a Mexican man convicted of unlawfully having a handgun that the ban was unconstitutional.