President-elect Donald Trump has chosen retired Marine Gen. James N. Mattis to be secretary of defense, nominating a former senior military officer who led operations across the Middle East to run the Pentagon less than four years after he hung up his uniform, according to people familiar with the decision.