It's happened to every foreigner in Japan: you come out of the toilet, back to the party, but before you even sit down, everybody starts laughing at you. Did you forget to button up your trousers? Is there toilet paper sticking to somewhere strange? No, you forgot to take off your toilet slippers again...
In almost every toilet in Japan are a pair of slippers that you're expected to put on before you go into the toilet, and take off before you leave. In some ways, this makes a lot of sense - after all, there are all sorts of strange substances that could potentially hit the floor in a toilet, and you wouldn't want that on your socks. However, the slippers in most people's homes look more like something designed to make rabbits want to mate with your feet, so they seem to be more for cuteness than hygiene.
Nevertheless, it's vital to remember to put them on when you enter the toilet, and take them off as you leave. Also, please note how they're always facing the right way when you enter - you can put them on without touching them with your hands first. This means you have to leave the toilet as you entered - facing the bowl itself. It takes a few tries to get the hang of it smoothly, but you'll have to shuffle off the slippers while walking backwards out of the toilet, and try to leave them in a fairly presentable pair.
When you're in Japan, you'll get used to taking off and putting on shoes more than you ever have in your life, and among all of these, the toilet slippers may just be the most important. Good luck!