The Ivory Coast international made 112 appearances across all competitions for Arsenal, scoring 27 goals, but completely fell out of favour under Mikel Arteta.
Pepe was so far down the pecking order that he spent all of last season on loan back in France with Nice, where he scored eight goals in 28 appearances.
Nice were not keen to make the deal permanent and it seemed that Arsenal were struggling to find a buyer for the Ivorian who is on substantial wages but is not in the first team plans.
Pepe has one year left on his contract and the club were considering terminating the deal early, but it seems they have found a way to avoid paying him off.
L’Equipe report that Besiktas are in advanced talks to sign Pepe this summer and a deal is likely to be done, with the transfer window in Turkey remaining open until Friday 15 September.
Arsenal will likely receive a nominal fee from the Turkish side, but more importantly get his wages off their books and put an end to an expensive and unsuccessful venture.
On Pepe’s future, Arteta said last week: ‘We are still looking for solutions.
‘There is a lot of communication between his agent and the player and the club at the moment but there is nothing else to announce at the moment.’
Besiktas have already snapped up Alex Oxlade-Chamberlain on a free transfer this summer after the midfielder left Liverpool, with the team competing in the Europa Conference League this season.
For more stories like this, check our sport page.