I know that he was injured, but he spent more than a few years in exile. Surely he wasn't hurt badly enough that he needed that much time to recover?
I previously posted this in the thread for short questions but was informed that I should post it as a regular question.
I'll try to answer your question, sorry if it doesn't satisfy you. Do note that i'll be focusing on Charles' time in the Ottoman Empire and Ottoman politics
Initially it was thought that his stay would only last for a short while, and that Charles XII would seek to return to Pomerania or Sweden as soon as possible, but there were different causes which contributed to the prolonging of this famous "visit". First, Charles XII‟s foot was wounded during the battle of Poltava. Second, All main roads leading to Sweden via Eastern Europe were all heavily guarded by Russians, making journey dangerous. Third and the most important factor was his ambition of halting the expansion of Peter the Great of Russia by keeping Poland allied to him and eventually also attracting the Ottoman Empire in this alliance, since communicating with the Sultan was considerably easier from within his Empire.
During his stay, he did his best to influence Ottoman politics so they will give him support in fighting Russia. At the time, the Porte was divided into 'war' and 'peace' faction. The former, comprised mainly of Crimean Khan Devlet II Giray, most of the army, and political opponents of the current Grand Vizier sought for war against Russia to negotiate the 1700 treaty and stop Russian expansionism near their border while the latter, comprised mainly of Sultan Ahmed III and Grand Vizier Çorlulu Ali Pasha sought to negotiate with Russia peacefully using leverages and international mediation. His first step in this was to send about 1,000 of his soldiers to watch the Polish border. When the Russians realized this and attacked Chernovich within the borders of the Ottoman Empire, it had a great impact in the Porte. Meanwhile, Tsar Peter through his ambassador Tolstoy demanded that the King of Sweden and Hetman Ivan Mazepa not be allowed to stay in the Ottoman territory for a long time and the renewal of the 1700 agreement. The request for Charles and Mazepa's extradition was not accepted, but an article concerning the King of Sweden was added to the renewed agreement. According to this article, the Charles, together with the number of Ottoman forces not more than 500 will come to Poland, and after crossing the border with the Russian forces he would be taken to Sweden. But the Swedish king showed no inclination to return home, and instead insisted on being accompanied by what was to have been a full-scale Ottoman army of 30,000 sipahis and 20,000 janissaries. Charles also objected the agreement, stating that because the Russians had violated Ottoman borders, accepting Russian agreements meant surrendering to the Russians in advance. In any case, there were also rumours in Constantinople that Çorlulu Ali Pasha had received gifts from Tolstoy in order to maintain his stance of neutrality. This rumour, which was probably spread by one Charles' general Poniatowski led to Çorlulu Ali Pasha's dismissal and replacement with Köprülüzade Damad Numan Pasha, who remained in office for only two months. His replacement, Baltacı Mehmed Pasha was more keen on war with Russia and with the aid of Khan Devlet II Giray, şeyhülislâm Paşmakçızâde Ali Efendi, and the majority of Ottoman statesmen successfully convinced Sultan Ahmed III to abandon the policy of neutrality. The Ottoman Empire declared war on Russia in November 1710 citing border attacks on Chernovich and the occupation of Kamanice as the cause. At first Charles requested to be present at Ottoman military camps, but his requests were denied and Poniatowski was chosen instead. The war went well for the Ottomans, in which the armies of Peter narrowly escaped annihilation. Field Marshall Sheremetev offered peace in Peter’s name, and it was accepted after some delay by Baltacı Mehmed on 22 July 1711 despite warnings from Devlet II Giray, Stanislas Lesczynski, the deposed king of Poland and Poniatowski, all stated that this might be the only chance to utterly annihilate the Russians. Attempts by Poniatowski to take the Tsar captive to Istanbul, to hand over all of the Russian army's weapons, or to recall the janissaries, have failed. Charles himself was swimming the Prut at the time in a last-ditch effort to reach the negotiations, but he arrived too late. He harshly criticized the Grand Vizier for the treaty, saying "Couldn't you at least capture the Tsar and bring him to Istanbul?". Charles further promised to capture the Tsar within a few hours if he had been given a few thousand janissaries and some cannons, but the proposal was not accepted because peace was already settled.
Greatly dissatisfied by the treaty, Charles wrote letters to the Sultan protested the treaty and accusing Baltacı Mehmed of unfaithfulness. Ahmed at first was adamant about this, but when he called Devlet II Giray to confirm this and learned that a great opportunity had been missed in Prut and the rumors that the grand vizier and other government officials took bribes spread, Baltacı Mehmed Pasha was dismissed on 20 November 1711 and exiled to Mytilene. Osman Ağa and Ömer Efendi, who were alleged to have received bribes from the Russians and thought to have significant impact on the signing of the agreement, were executed. As the Russians initially doesn't fulfill the peace treaty, Ahmed declared war on Russia a second time to intimidate the Tsar. When the Russians understood the seriousness of the decision of the Ottoman Empire on war, the two Russian ambassadors who had been withheld in Yedikule applied to the Porte through the British ambassadors and the Dutch ambassadors to enter negotiations. The treaty of Adrianople was ratified in June 1713. This agreement effectively ended Charles' hope of further Ottoman intervention and secured Charles safe passage to Sweden.
By this time, with the treaty ratified, Charles' stay in Bender becomes quite problematic because there's no reason for him to stay anymore. Charles however still doesn't want to leave, afraid of hostile enemies and difficulty in winter conditions. To escape from this impasse, in 1713 Ahmed III ordered the janissaries stationed in and near Bender to burn down the residence where Charles was staying. Following this event, known as the kalabalık (crowd action) in Ottoman sources, the King was forcibly removed from Bender to the vicinity of Edirne. Once he had been taken away from Bender and brought to the Ottoman centre, the political options of Charles XII were drastically curtailed, although he continued his contacts with European rulers, including the King of Prussia. Further Russo–Ottoman and Polish–Ottoman peace treaties of 1714 finally made it clear that Ahmed III was not going to intervene any further in the affairs of Eastern Europe, and in the autumn of that year, after a five-year-long stay, Charles XII returned to Sweden. During his stay he had first been treated as a state guest and later rather more like a prisoner, albeit of honoured status.
Sources:
İsveç Krali Xii. Charles'in (Demi̇rbaş Şarl) Osmanli Devleti̇'ne İlti̇casi (1709-1714) Ve İlti̇ca Süreci̇nde Ülkesi̇nde Ombudsman Görevlendi̇rmesi̇ne İli̇şki̇n Bi̇r Değerlendi̇rme by Burak Coşkun and Hamza Günaydın
Ottoman Wars, 1700–1870 by Virginia Aksan
Travel and Artisans in the Ottoman Empire by Suraiya Faroqhi