When asking this question about parties, and why they oppose legalization, there are two potential aspects to "why": reasons for the policy as an end in itself, and reasons for the policy as a means to attaining and retaining power. My answer focuses on the latter, as in my experience there does not seem to be a right-wing consensus that drugs (and especially not marijuana) should be illegal. I think my view here is somewhat in line with your observation that drug prohibition is contrary to what you view as conservative values about the role of government.
Groups that hold power, and especially right-wing parties, thrive on rules with harsh penalties that forbid things large portions of the population are doing, that can be selectively enforced against members of groups they want to keep disempowered, including even members of "their own" who step out of line. It facilitates disenfranchisement of groups likely to vote (or, in a non-democratic system, otherwise organize and rise up) against them. Further, the ability to get by with breaking the rule as long as you're one of the "in group" builds feelings of loyalty and unity.
This does not mean every person who supports or identifies with a right-wing party shares the above view or motivation. Many don't actually support drug prohibition, or if they do, subscribe to one or more of the narratives politicians use in justifying it, such as concern that a culture of tolerance of drugs will lead to their children becoming drug addicts or that drug users are a threat to their lives or property.
While my view here is not based on this one account (rather built on a multitude of experiences and assimilation of sources over decades) and I didn't have this in mind when first writing the answer, John Ehrlichman's account of the origins of the drug war supports what I claim:
"The Nixon campaign in 1968, and the Nixon White House after that, had two enemies: the antiwar left and black people," former Nixon domestic policy chief John Ehrlichman told Harper's writer Dan Baum for the April cover story published Tuesday.
"You understand what I'm saying? We knew we couldn't make it illegal to be either against the war or black, but by getting the public to associate the hippies with marijuana and blacks with heroin. And then criminalizing both heavily, we could disrupt those communities," Ehrlichman said. "We could arrest their leaders. raid their homes, break up their meetings, and vilify them night after night on the evening news. Did we know we were lying about the drugs? Of course we did."
There's room for debate as to how biased this account is, but it matches what groups who claim to have been targeted have been saying since long before the Ehrlichman interview was published.
Regarding the general principle of selective enforcement of laws widely broken (including drug laws) against groups of people more likely to vote against right-wing parties, the ACLU of NJ has a report from 2015, and it's widely accepted that this kind of disparity exists. Moreover I don't think it's under serious doubt that enforcement tends to prevent (via incarceration) voting against right-wing candidates and tends to break down social and economic stability needed for affected groups to organize politically, or that their doing so wouldn't shift power away from the right.
Outside of the US, Duterte's Philippine Drug War seems to be a similar phenomenon of right-wing use of drug prohibition as a weapon against political opponents.