About 40 employees of an Oakland, Calif., marijuana-growing company joined the Teamsters union earlier this month, becoming what are believed to be the first pot growers to unionize in the country.

Employees of the grower, Marjyn Investments LLC, which grows pot for medicinal purposes, approached the union earlier this year, said Marty Frates, secretary-treasurer of Teamsters Local 70. The pot-grower's employees ratified a two-year contract in early September, he said.

Use of marijuana for medicinal purposes is allowed under California law, although it is still a violation of federal law. Medical-pot dispensaries are common in big California cities.

Marijuana-legalization supporters tout the unionization as a sign of the drug's growing legitimacy. The move also boosts Teamsters at a time of dwindling membership. "We've had our problems," Mr. Frates said, "so we've had to diversify."

Under the contract, Marjyn employees will make $18 an hour and about $26 an hour within 15 months, Mr. Frates said. They will also get health-care and pension benefits.

Clinton Killian, a lawyer who represents Marjyn, said the company thinks the unionization is a "great idea" that "benefits the company by giving us a stable, committed workforce in a protected environment."

Marijuana opponents derided the move. "I think it's pathetic," said Roger Morgan, executive director of the Coalition for a Drug-Free California. "I think Oakland is an embarrassment to California to begin with," for its lax attitude toward pot, "but for the Teamsters to throw in with them is just over the top and they should know full well that marijuana is illegal by federal law."

Oakland has one of the country's most accommodating attitudes toward marijuana. Residents of this Northern California city of 400,000 last year approved the nation's first pot-specific tax. Oakland's city council in July voted to allow industrial-scale medical-marijuana growing in the city.

The city is also home to Oaksterdam University, which teaches students how to become pot entrepreneurs. Oaksterdam employees are represented by United Food and Commercial Workers 5, though the workers have not yet ratified a contract, said leaders at both the school and union.

Californians in November will vote on Proposition 19, which would let adults possess marijuana and allow local governments to legalize and tax marijuana sales. A Sept. 2 SurveyUSA poll showed 47% of likely voters supporting the measure, versus 43% against.

Write to Stu Woo at Stu.Woo@wsj.com