This is again being used for obvious political reasons, but there are in fact such laws in many countries. [1]
The UK had enacted a similar restriction the last time they had riots, in 2011.
This is usually aimed at stopping people who are obviously up to no good before they actually break something or hurt someone. Wearing a mask may also embolden people to do something they would not otherwise do if they were not wearing a mask.
[1] https://en.wikipedia.org/wiki/Anti-mask_law