SÃO PAULO—For the second time in as many months, Brazil's government sent soldiers to maintain order at one of its World Cup host cities after police went on strike, but this time against a backdrop of nationwide protests.

An undisclosed number of federal troops on Thursday began entering Recife, the capital of the northeastern state of Pernambuco, where shops and supermarkets were ransacked, state officials said.

State...