The bill, called Carly's Law, was heralded by the parents of 3-year-old Carly Chandler, who suffers from epilepsy due to a rare genetic disorder.
The bill passed both the Senate and House, and Alabama Gov. Robert Bentley said he intends to sign the legislation.
Once signed, the law would allow researchers at University of Alabama at Birmingham to prescribe the oil, called CBD, to patients like Carly. CBD does not cause a psychotropic effect in users like marijuana does.
The bill received unanimous support.
"When it comes down crunch time, on the real important issues, we saw last night that we can put down our mantles. We can put down the Ds and Rs. We can put down the conservatives and the liberals. And we can be moms and dads and grandmas and granddads," said Rep. Allen Farley, who sponsored the legislation.