Los Angeles Superior Court Judge Keith Schwartz also sentenced 26-year-old Redmond O'Neal to serve five years on probation.
District Attorney's spokeswoman Jane Robison says O'Neal could be sent to prison for up to three years if he violates probation.
Redmond O'Neal also pleaded no contest to being a felon in possession of a firearm when he was arrested Aug. 2 after a traffic stop. Ryan O'Neal attended his son's sentencing Wednesday.
Attorney Richard Pintal, who represented the younger O'Neal, says the sentence recognizes that his client is facing serious addiction and medical issues and that treatment was more appropriate.