Per Chris Biderman of Niners Wire, the Tuscaloosa County Sheriff's Office booked Foster on Friday and set his bond at $2,500.
Foster failed a drug test at the 2017 NFL Scouting Combine when his urine sample came back diluted. He attributed it to having food poisoning.
"I couldn't eat much, but I had to drink water and Gatorade," Foster told NFL.com's Ian Rapoport. "Then a few coaches said something about me being too light. And I'm a coach-pleaser. I don't care what everybody thinks, but I care what coaches think. So I drank and ate as much as I could without throwing up. Then I went in there, drinking and drinking water, trying to flush out my system from whatever was making me sick and trying to keep my weight up and took the test."
The 49ers selected Foster with the 31st overall pick in 2017. The 23-year-old led the team with seven tackles for loss and ranked second with 72 total tackles despite missing six games due to injuries.
Foster played college football at the University of Alabama. He was named the Butkus Award winner in 2016 as the nation's best linebacker.