Officially slavery was banned by Hideyoshi in 1590 due to disgust amongst him and other members of the ruling class. While slaves had been taken as part of spoils of war (namely, some captured soldiers would be enslaved) since the early days of Japan, by the time of the Sengoku era this attitude had changed. Disgust at Portuguese trading of Japanese peoples as slaves, combined with suspicion of Christian missionary efforts in Japan, led to the official ban, although indentured servitude and families "selling their daughters" persisted for some time afterwards.
August 30, 1945 MacArthur arrives in Tokyo and immediately orders the cessation of all forced labor. All prisoners of Japan were ordered to be freed and humanely returned to the countries from which they came. This would mark the end of Japanese slave labor within Japan. The last official surrender of forces was September 12, 1945. But this was the surrender of forces in Southeast Asia. presumably slave labor would have continued for prisoners in these areas until this date.
The ruined economy and famine of 1946 forced many Japanese to work in a state of near slavery for a time but by 1948 the US had largely rebuilt Japan to use as a base against the Soviet Union and the standard of living had improved for most Japanese.