The 32-year-old moved to the Rec in 2003 and has made 161 appearances for the club.
Flatman also won eight England caps but his career has been blighted by injuries and he has now decided to call it a day, instead taking up a backroom role with Bath.
"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 on bathrugby.com.
"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."
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The Barbarians are one of the top invitational rugby sides with a long history and classic rugby jersey.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Lions get ready for their matches with this green training jersey. It's what the players wear. Get in the Gear!
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
$29.99
The Lions are ready to get their Australia tour underway. They arrive in Perth on Monday.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.