LONDON—The resignation of two Brexit hard-liners from U.K. Prime Minister Theresa May’s cabinet plunged her government and party into a political crisis that threatens to change the country’s course toward leaving the European Union.

Britain is due to leave the bloc in less than nine months, and the resignations of Foreign Secretary Boris Johnson and David Davis, the minister in charge of Britain’s negotiations to leave the EU, blew apart a fragile truce in the government over its Brexit strategy.

Both...