HONG KONG—Authorities here are planning to invoke a British colonial-era law for the first time in half a century to ban people from wearing masks at protests, people familiar with the matter said, as police struggle to contain spiralling violent unrest throughout Hong Kong.

The emergency law gives the government sweeping powers, but for now the city’s leader, Chief Executive Carrie Lam, is proposing limiting the measures to outlawing gas and other masks that have become a fixture of protests, a person familiar with the plan...