WASHINGTON — President Trump intends to campaign Monday for Gov. Henry McMaster of South Carolina, according to Republican officials familiar with the plan, putting his presidential prestige on the line for one of his earliest supporters a day before the state’s closely contested Republican runoff election.

In a gamble that he can lift Mr. McMaster to the nomination at the 11th hour, Mr. Trump intends to join Mr. McMaster for a rally in the Columbia area hours before the polls open in the state.

And this Saturday, Vice President Mike Pence will campaign with Mr. McMaster, who is locked in a close race for the Republican nomination with John Warren, a former Marine and political newcomer.

The White House’s last-minute intervention amounts to political payback for the governor, who was among the first statewide Republican elected officials to support Mr. Trump. Mr. McMaster has been an outspoken ally of the president ever since. He has argued that Mr. Trump should receive a Nobel Peace Prize for his negotiations with North Korea, and this week he defended Mr. Trump’s hard line on immigration and the separation of children from their families at the border.