Ba, 29, arrived in Istanbul in midweek to undergo a medical and pose with the number nine jersey he will wear next season.
The Senegal forward said: "I've had a lot of positive feedback about Besiktas and Istanbul from my Senegalese friends in Turkey.
"To play in a Muslim country and in a new stadium is definitely very exciting.
"I know what my coach Slaven Bilic expects from me, and I am open to all sorts of competition.
"Since Besiktas fans like hard-working and spirited players, I will give everything I've got in order not to disappoint them."
Ba joined West Ham from Bundesliga club Hoffenheim in 2011 and moved on to Newcastle in the same year.
After scoring 29 goals in 54 appearances for the Magpies he moved to Chelsea, but made only 23 starts, scoring 14 goals.
Besiktas president Fikret Orman said this week he was delighted with his club's new acquisition.
"Ba is a player we all believe in, we put in a lot of time and effort to complete the transfer to the best of our interests," Orman said. "The transfer is within our budget and we are delighted to have completed the move."