It is a law, as it is part of the US Code, but there are no penalties listed as part of the statute, so there are no criminal implications to not following the statute.
The key words to understand in the statute are "should" and "may." Those do not mean "must." If the statute stated "must," then we can assume there would be a penalty mentioned.
The document to read, which covers all pertinent aspects of flag etiquette and suggested behavior during flag ceremonies and the pledge of allegiance (as well as legal history) is Federal Law Relating to Display and Associated Questions - usflag.pdf (my emphasis) :
The Flag Code does not prescribe any penalties for non-compliance nor
does it include enforcement provisions; rather the Code functions
simply as a guide to be voluntarily followed by civilians and civilan
The Federal Flag Code does not purport to cover all possible
situations. Although the Code empowers the President of the United
States to alter, modify, repeal, or prescribe additional rules
regarding the flag, no federal agency has the authority to issue
“official” rulings legally binding on civilians or civilian groups.
Consequently, different interpretations of various provisions of
the Code may continue to be made. The Flag Code itself,
however, suggests a general rule by which practices involving the
flag may be fairly tested: “No disrespect should be shown to the
flag of the United States of America.” Therefore, actions not
specifically in the Code may be deemed acceptable as long as proper
respect is shown.
It's possible that bills may be passed by Congress or attempts made by presidential executive order (EO) to criminalize behavior related to flag etiquette, but if such laws or EOs became laws, they would conceivably need conflicts with the First Amendment settled by the courts.