Technically, no. Japan bans paid intercourse, yet the sex industry is large, visible and mostly operates within the gaps in the law. The honest answer is that the law is narrower than most people assume.
What the law says
The Prostitution Prevention Law of 1956 defines prostitution as intercourse with an unspecified person in exchange for payment, and says nobody may engage in it. It sets no penalty for the act itself. The penalties apply to soliciting, to brokering and procuring, to providing a place for it, and to living off the proceeds.
Why the industry exists
Two things keep it going. First, the definition is narrow: services that do not count as intercourse fall outside it, and a whole sector of clubs and delivery services is built around that. Second, venues are registered under a separate amusement business law, and where sex does happen on those premises it is treated as a private matter between two people who happened to meet there.
Foreign visitors
The law applies to visitors as it does to everyone. Some venues refuse foreign customers, and the areas best known to tourists are also the ones where overcharging, drink spiking and street touts are most common. Embassies, including those of the United States and the United Kingdom, warn their citizens about these scams, so treat any approach on the street as a risk.
Age and exploitation
Anything involving someone under 18 is a serious crime. Trafficking and coercion are also offences, and Japan has faced international criticism over exploitation in parts of the industry.
How it compares
England and Wales allow paying for sex between consenting adults but ban brothels and public soliciting. Read the UK law guide for the detail, or the country by country guide for everywhere else.