For instance I have heard in Japan, you can get years of prison for personal amounts of weed. What reasons would they have had to ban and harshly punish the use of what was prior considered an innocuous drug in most of the world?
Its a very loaded question to ask for a generalization of why all countries with harsh drug laws have such laws, since the reasons are usually specific to one country's history and gsopolitical situation.
Places like Saudi Arabia have it because of their legal system being based upon religous scripture which largely admonishes thought-altering substances. Places like Brazil or Colombia have them because of a large conflict with organized crime syndicates which base most their profits on drug trade, etc, etc...
There is also a tinge of US cultural and political influence, in order to stem supply of drugs to US market, but again, its highly localized and one canr speak in such large generalities
I will although give a bit of insight into Japan's situation as their drug laws are staggeringly harsh for a functioning democracy and their cultural attitude to drug users is highly polarized, due to the complicated history of western influences and various homegrown cultural movements.
For starters drug regulation and criminalization started with the first International Opium Convention in 1912, where a resolution was made prohibiting the abuse of opium, morphine and cocaine, the reason Japan ratified it was because ut was incoporated in the Treaty of Versailles in 1919, which Japan signed in an effort to show its westernization and eek out a place among western powers.
The provision was relatively minor at the time and wasnt seen as an important part of the Treaty, but Japan enforced to show its effort to westernize and also as a prevention because of the opium epidemic witnessesed previously in China.
Although it must be noted the provisions of those days were related to the manufacture of cannabis (which could be allowed through a notification to the Interior Minister), import and export and transfer procedures, as stipulated through Interior Ordinance 1930 - 17.
The real start of heavier provisions and criminalization of possession/use started with the Imperial Decree No. 542, 1945. This was a a part of the ratifucation of the Potsdam Emergency Decree for Japan after its surrender to the US in 1945 and its subsequent approval of the Postdam declaration.
This law was highly enforced by the US occupation force and the various laws regarding drug use and distributiob were highly encouraged to be followed. These provisions basically destroyed most farmer cultures of hemp production, which had been a native plant to Japan which was widely used for traditional textiles, but also ingrained a distaste for drugs in the general public.
This distaste only increases as drug marijuana was lumped with various subcultures, like futen-zoku(japanese hippie subculture which mainly used organic solvents) and the yakuza, which used and traded metamphetamine heavily(as a result of its popularity with US troops during the start of the occupation process), due to its drug status.
And since the most powerful political coalition in Japan is highly conservative and conservative-leaning, the goverments are encouraged to take tough stances on drugs and "shunned" crime in general.
But there have been cracks in that, mostly due to the twofold pressing of some conservatives trying to revive hemp as a traditional textile and farm plant to veer away from western influences and progressives trying to decriminalize drug usage and the use now being obiquitous through the internet as a trading hub which cant be easily regulated.
For example the First Lady of Japan visited a hemp farm and tried to promote such farming in her social media in 2015, events like this have itensified the drug debate in Japan and revived the look at its history.
This is an article of her visit https://www.wsj.com/articles/BL-JRTB-21290
Kiyoshi Wada has an interesting writing on the topic of drug abuse and criminalization in "The history and current state of drug abuse in Japan"(2011)
Also Masamutsu Nagahama, Chief of the 2nd Narcotics section in 1968 had an interesting report on the measures, effects and reasons for various drug classifications and legislation.