I think it's quite possible, many places have laws against covering one's face (during a protest or otherwise) and if they made it illegal to go out without face mask protection during the covid crisis you could find yourself in this situation.
The sentence in the title as it is implies it is illegal for a person to be both wearing and not wearing a mask at the same time. It’s a grammatical error.
It is not a grammatical error: such an error would mean that the sentence is not constructed according to the grammatical rules (of English), when clearly it is. What you probably meant is that it's a semantic error: the writer used a construction which doesn't not convey the intended meaning.
As an example, substitute the impossible fact of both wearing a mask and not wearing a mask by "both walking and not looking frontward" and you would obtain a sentence following the same construction, yet doesn't seem to carry an incorrect meaning.
The effect of such a combination of laws would be to make it unlawful to go outside. The effect of a law as stated in the tweet would be to make enforcement impossible, as nobody would be both wearing and not wearing a mask: each perp would be doing one or the other.