The Trump administration is planning to dispatch 800 or more active-duty troops to the southern border at the direction of a president who has sought to transform fears about immigration into electoral gains in the midterms as a caravan of thousands of migrants makes its way through Mexico.