BEIJING—As China grows more optimistic about containing the spread of coronavirus within the country, it is confronting a potential threat to its recovery: the rest of the world.

Epidemic-control efforts have turned to foreigners in China in recent days as confirmed cases within the country have slowed. Police officers and local government workers have made house calls specifically to check whether expatriates recently traveled to another country where they could have contracted the virus.

...