The title downplays this a lot. The first sentence in the article reads "Any extramarital sexual encounter (...) could result in a seven-year jail sentence." That usually means any sexual relation outside of marriage is forbidden, even between life partners.
I wonder how they would verify that with foreigners, especially those with a history of poor record-keeping. I surmise that there must be at least a couple of countries where a marriage certificate is nothing more than a plain sheet of copy paper with something along the lines of "I hereby declare that X and Y are married" in their local legalese. Although I can't help but snicker at the image of a bunch of poor cops…
Unbeknownst to us there was also a law that unmarried heterosexual couples couldn’t share hotel accommodations. In some places this meant the men had to share a room and the women had to share a room because, when asked, we couldn’t provide a marriage certificate. (Ironically their strict enforcement of the law intended to prevent premarital sex would have the opposite effect.) But in some hotels the way they got around this was to simply note that we were married. Often without even asking. And in one instance when things got a bit dicey the hotel manager was sufficiently satisfied of our “marriage” by seeing the receipts of our other hotel stays.
All of that is to say I got the impression it’s a very subjective and selectively enforced thing.