Davis, 25, joins linebackers Patrick Willis, 30, and Chris Borland, 24, and defensive lineman Justin Smith, 35, in retirement.
"After a few years of thought, I've decided it will be best for me to take a year or so away from the NFL," Davis said in a release. "This will be a time for me to allow my Brain and Body a chance to heal. I know many won't understand my decision, that's ok.
"I hope you too have the courage to live your life how you planned it when day dreaming to yourself growing up. Your Life is Your dream and you have the power to control that dream. I'm simply doing what's best for my body as well as my mental health at this time in my life."
Davis, the No. 11 overall pick of the 2010 draft out of Rutgers, had not been attending the Niners' voluntary OTAs after an injury-wracked 2014 season. He began his NFL career by starting his first 64 games, but shoulder, hamstring, knee and ankle injuries, as well as a concussion, limited him to seven games last season.
Davis was a major cog in the Niners' power-running game. With him out, Jonathan Martin became the starter at right tackle, and the 49ers went away from the ground game.
In Week 11, against the New York Giants, Davis said he took a "spinning elbow" to the head late in the game and was concussed. More than two weeks later, he said he was still feeling the effects.
"It's scary when your brain's not working the way it's supposed to," Davis said at the time, describing a "white fog" he had to fight through.
Since Martin was waived this offseason, seventh-round draft pick Trent Brown has been running with the first-team offense at right tackle.
"The 49ers organization thanks Anthony for his contributions to our team over the last five seasons and wishes him the best as he moves on from the game," 49ers general manager Trent Baalke said in a statement.
Coach Jim Tomsula said he communicated with Davis via text before Friday's organized team activity practice.
"Anthony's been working on himself right now. That's what he's been doing," Tomsula said. "Look, Anthony wants to step away, and he wants to get his mind and his body right, and that's where he wants to go and he has every right to do that."
Tomsula, though, would not categorize the loss of Davis as a "huge blow" to the Niners.
"I wouldn't categorize it that way," Tomsula said. "We've got some guys doing some really good things right now that we're really excited about moving into training camp. But no, we're really excited about the guys that are here. That's what we've said all along. The focus is on the guys that are here and the guys that are doing what they are doing."
49ers lose another veteran to retirement
ESPN 49ers reporter Paul Gutierrez discusses how San Francisco will be affected by the retirement of offensive lineman Anthony Davis, the fourth 49er to retire this offseason.