That’s fairly easy. A swift look into the Penal Code of Thailand and you new more.
Yes, there is a penal code even there are some people around who are trying to ignore this fact of life.
The penal code of Thailand is sometimes surprisingly precise. But do not just trust the codes wording, especially the paragraphs 282 and 283 which are dealing with prostitution, moral and trafficking. There are some amendments to it which are not that easy to detect. And this can lead to some truly surprising results for some people.

Penal Code Amendment Act (No. 14) B.E. 2540 (1997).
Royal Gazette, 1999-09-14, Vol 116, Chapter 81L (Kor)
Laws Relating to Prevention and Combating Commercial Sexual Exploitation and Trafficking in Women and Children, Bureau of Anti-trafficking in Women and Children, Department of Social Development and Welfare, Ministry of Social Development and Human Security, pp. 28-32

Provides that those who commit an offence under the Act outside of the Kingdom of Thailand may be punished for that offence in Thailand. It extends the grounds for this to sexual offences as provided in sections 282-283 of the Act. Sections 282-283 sets out the offences and penalties for those who, for sexual gratification of another person, procures, lures or traffics a man or woman for an indecent sexual act. The penalty is increased if the person being exploited is between 15 and 18 years old (maximum 15 years in prison plus a fine) or under 15 years old (maximum twenty years in prison and a fine). If deceitful means, threats, physical assault, immoral influence or mental coercion is used, the penalty is again increased. It also creates the offence for those who bring or conceal, a person for indecent sexual acts and for those who receive, sell, procure, lure or traffic a person for gaining illegal benefit.
Date of entry into force: 1999-09-15

1996-10-14 THA-1996-L-46403
Thailand
Criminal and penal law
Prevention and Suppression of Prostitution Act, B.E. 2539 [1996].
Royal Thai Government Gazette [translation], 1997-02, Vol. 51, No. 2, pp. 79-89
Laws Relating to Prevention and Combating Commercial Sexual Exploitation and Trafficking in Women and Children, Bureau of Anti-trafficking in Women and Children, Department of Social Development and Welfare, Ministry of Social Development and Human Security, Thailand

Prohibits prostitution, both male and female, in public places and brothels, and sets penalty for offering sexual services at a fine of 1000 Baht. Also prohibits advertisement for and procurement of prostitutes as well as ownership or management of brothels. Penalizes persons who conduct sexual relations with a prostitute under 18 years of age with imprisonment of up to 2 years; if the prostitute is a child less than 15, the term of imprisonment shall be up to 6 years. Procurement of prostitutes under the age of 18, including by owners of brothels, parents and legal guardians, shall be punishable with up to 20 years of imprisonment. If parents or legal guardians are party to procurement of a child prostitute, a court may also withdraw legal custody of the child. Persons who force another person into prostitution through violence or intimidation shall be punishable with up to 20 years of imprisonment; if such actions result in injury or death, punishment shall be life imprisonment or execution. The Act also establishes a Committee for Protection and Development of Occupation (P.D.O.) which shall prescribe and implement policies for the eradication of prostitution. Also provides for the establishment of rehabilitation institutions known as the Place for First Receiving, and the Place for Protection and Development of Occupation. The Place for First Receiving shall receive persons convicted for prostitution and assess their mental and physical health, as well as their aptitudes. Convicted prostitutes may then be sentenced to the Place for Protection and Development, which shall provide occupational training and rehabilitation. Repeals the Prostitution Suppression Act, B.E. 2503.
Date of entry into force: 1996-12-14

There are a lot more to read. And all of this can be dealt with some flexibility. If you get bored, just read the Royal Gazette, which is truly wonderful stuff.... But read it with Thai eyes - forget all your foreign background.

There are also international agreements to meet with nearly all neighbouring countries including Cambodia, China, Indonesia, Laos, Malaysia, and Vietnam in order to combat any violation of law especially regarding drugs, prostitution, human trafficking and others indecency in order to keep the standards of moral up. There is also a steady and increasing exchange of information.

This used to be very good business for some police officers or civil servants. But even if Thailand is topping many records regarding corruption, this common pest is also a crime.

The now called in Special Squad are just right there to teach the locals a lesson and restore the order as required. This highly specialised task force is not just busy in Pattaya but all over Thailand. Violating the law can not be acceptable. No system will tolerate this for long, neither in Australia, the US, Europe or Thailand.