Mr. Trump’s prediction that he would support the bill is the second time this week that the president has taken a position directly contradicting the policies driven by his own attorney general, Jeff Sessions, with whom the president has been openly hostile, even saying recently that he wished he had selected someone else for the job.

This week, Mr. Trump commuted the sentence of Alice Johnson, a 63-year-old serving a life term in federal prison for a nonviolent drug conviction. Last year, Mr. Sessions directed federal prosecutors to reverse former President Barack Obama’s work to ease punishment in nonviolent drug cases. On Friday, the president said his aides were reviewing similar cases that appear to have drawn “unfair” treatment from the justice system.

During his presidential campaign, Mr. Trump said the enforcement of marijuana laws was a state issue. That changed once Mr. Trump occupied the Oval Office. His press secretary, Sarah Huckabee Sanders, has said his evolution on the policy is a result of Mr. Trump believing in “enforcing federal law.”

“That would be his top priority, and that is regardless of what the topic is,” she said.

Currently, 30 states and the District of Columbia have legalized marijuana for medicinal or recreational use. Mr. Gardner has emphasized that his proposal does not call for broadly legalizing marijuana across the country.

“Instead, it allows the principle of federalism to prevail as the founding fathers intended and leaves the marijuana question up to the states,” Mr. Gardner said in a Twitter post on Thursday.