At least it was never outright illegal, unlike many Western countries at the same period, where they'd have to fear all sorts of repercussions (depends on the exact date and country and frankly some randomness of course). Not that I imagine it'd be easy in Japan during that period either ^^
Sodomy was illegal during the Meiji restoration for few years
Must have been the Westernization. They tried really hard to please the British and Americans, at the time, by making the country more like theirs; and a lot of really stupid laws were the result.
"Please", Hell. They pretty much wanted to become them (and the Germans while they were at it).
You're absolutely right. I understated the extent of the problem.
Heck, just as an example: the gakuran and the sailor-style dress worn by school students have become by now an inseparable part and even a symbol of Japan's culture, and a big sexy fetish to boot. People have pretty much forgotten where the idea originally came from, haven't they?