Flatman made 53 appearances in ERC matches and was part of the Bath side which won the Amlin Challenge Cup in 2008.
"It's been a difficult decision to make, but you have to listen to medical experts when they tell you it's time to stop," he said. "Naturally, it's tough coming to terms with this, but the club have been fantastic in their support. I have truly loved my time as a Bath player, and would like to thank all the players, coaches, staff and supporters who have made it so enjoyable.
"I've forged memories and friendships that will last a lifetime, and feel incredibly proud to have worn the jersey. I'm looking forward to staying with Bath in what I have no doubt will be a challenging but exciting new role."
Flatman made 161 appearances for the club and played eight times for England, winning his last cap in 2010.
Bath will be competing in Pool 4 of the Amlin Challenge Cup next season against Agen, Cammi Rugby Calvisano and Bucharest Wolves.