"When they first came" is understood to mean "at the start", and doesn't imply that they came a second time.
The problem with your second sentence is pronoun confusion. "They" in the first sentence means "the people". But in the second sentence "they" means "the masks". It is understandable, but confusing. You can't tell that "they" means "masks" until you have heard and understood the second half of the sentence. The second half is even more confusing because it uses "came" with a different meaning from the first sentence. That makes it a "garden path sentence", which is bad style.
It would be better to phrase the second sentence as "Then they took them off." This phrasing doesn't lead the listener "down the garden path".