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 entire All Blacks apparel line has been updated for 2013/14. Check out the New Zealand All Blacks polo.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Gilbert Blitz 8S rugby cleat is a great cleat at a great price of $69.99. Get a new pair of cleats today.
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.
The All Blacks Performance t-shirt is black with hints of blue from the training jersey. Very Cool.
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.