The president, speaking alongside Prime Minister David Cameron, said a Britain outside the bloc would move to the “back of the queue” for a trade deal with the United States.