"Our organisation has undertaken a major mediation role in this exchange operation, which is the most comprehensive of the recent period," the National Intelligence Agency (MIT) said in a statement.
The other countries included the United States, Germany, Slovenia, Norway, Russia and Belarus, according to Ankara.
Of the prisoners, 10 were relocated to Russia, 13 to Germany and three to the United States, the Turkish president's press service added.
The prisoners included Wall Street Journal reporter Evan Gershkovich and US marine Paul Whelan, both of whom had been imprisoned in Russia.
Russia's independent website Insider wrote on Thursday that Poland had released Pavel Rubtsov, a Russian military intelligence (GRU) agent.
Rubtsov was detained by Polish law enforcement services on the Polish-Ukrainian border on February 27, 2022.
He claimed to be a Spanish journalist and used the name Pablo Gonzales. He was said to be using the status of journalist to gather information on Ukraine for Russian special services and to gain trust of Russian oppositionists. (PAP)
jd/mr