WASHINGTON—President Trump signed a bill designed to show solidarity with pro-democracy protesters in Hong Kong, despite previously expressing reservations about the legislation because of its potential to complicate U.S.-China trade talks.

The Hong Kong Human Rights and Democracy Act of 2019 reaffirms and amends the U.S.-Hong Kong Policy Act of 1992, detailing U.S. policy toward Hong Kong and ordering an assessment of the political developments there, among other things.

“I...