You will notice that slippers are provided for you to wear in some public toilets, such as those in swimming pools, restaurants and any other places where you will have previously removed your shoes, such as in a private residence. What is the reason for this?
There are many customs in Japan that are unfamiliar to those from the West and the slippers in the toilet is probably one of the strangest ones to get your head around. Particularly when you are in a private residence and have been given house slippers to wear. You will be expected to remove your house slippers before entering the toilet and to wear the toilet slippers.
As far as I can figure out the reason for this is because, as in the west, the toilet was once outside and now even though the toilet is now indoors, metaphorically it is still outdoors and is considered dirty therefore you are expected to put on outdoor slippers when you enter the toilet.
Another slipper related custom that always baffles me is that when you are in a private residence and you are given slippers to wear, you will be expected to take them off if you walk on the carpet. This is something that often catches me out and has my wife and my in-laws quite animated. Even back at home my wife will remove her slippers at the foot of the stairs where the carpet begins.
Hotels in Japan will always provide guests with slippers to wear in the rooms, some, particularly Onsen hotels, will insist on shoes being removed in the reception area.
Visitors to Japan need to be careful to remove shoes whenever entering a private residence, you will be told if you get it wrong and it may cause great offence.