The first Federal Law regarding Cannabis was the Marihuana Tax Act of 1937 signed by FDR which was passed largely due to exaggerated and false claims such as this one:
That wasn't the problem with the law though. It levied a tax if you were found possessing, selling, or manufacturing Cannabis. You had to have cannabis to get the tax stamp. You couldn't get a tax tamp if you had cannabis. Therefore it violated the 5th amendment against self-incrimination.
However I do believe just based on who Leary is led to the creation of the war on drugs by Nixon. Timothy Leary led the case against the Government to have the act repealed in 1967 so for a brief period in time cannabis was legal. Leary as a professor and activist encouraged drug use and was seen as a dangerous figure by the Nixon administration. I do believe the hippy subculture in general scared a lot of people into supporting this and the overall drug laws which were passed in opposition of medical research like MDMA for example.
In conclusion it is unfounded fears that lead to it being illegal both times. They used race as a factor in all drug legal issues. For example, FDR appointed Dr. Hamilton Wright as Opium Commission of the United States. In this position he made claims such as "cocaine is often the direct incentive to the crime of rape by the Negroes of the South and other sections of the country," and ""one of the most unfortunate phases of smoking opium in this country is the large number of women who have become involved and were living as common-law wives or cohabiting with Chinese in the Chinatowns of our various cities". Right or wrong. These are bad justifications to make these type of drugs illegal and they were used for cannabis throughout history. His actions were instrumental in getting the Harrison Narcotics Tax Act passed and signed. Despite his last name the act was proposed by Francis Harrison, a Congressional Rep.