Ba was without a club after leaving Switzerland side Lugano following a short spell this summer.
The former Senegal striker turned out for the likes of Hoffenheim, West Ham United, Besiktas, Chelsea, Goztepe and Chinese Super League side Shanghai Shenhua among others.
In a post on Twitter, Ba wrote: "It is with a heart filled with gratefulness that I announce the end of my playing career.
"What a wonderful journey it has been. Beside all the sweat and tears I have faced, football has given me so many beautiful emotions. From the passion of the fans and the noise coming from the stands after every goal to the connection with my teammates on and off the field, this will forever remain in my head and heart.
"I wanna thank everyone I've crossed paths with and helped me grow, every club and manager for given me an opportunity, the fans for their tremendous support and my family and friends for their unconditional love.
"From the bottom of my heart THANK YOU. Praise be to the almighty."
Ba won league titles with Besiktas and Istanbul Basaksehir in Turkey, and his most famous goal for Chelsea was against Liverpool when he capitalised on a Steven Gerrard slip to dent the Reds’ title charge in the 2013/2014 season.
Ba won 22 caps for Senegal and scored three goals.