It's Free Real Estate
In many ways, the end of the First World War was sought to make as few changes in the Balkans and Near East as possible. In practice, it led to a total upheaval of the power balance in the Balkans. In theory, there were no actual territorial changes. However, the Albanian vilayets were placed under the de facto administration and control of Italy, which quickly replaced Ottoman (in practice, mostly Ottoman Greek) administrators with Italian administrators. Italy notably jumped at the opportunity to occupy these regions - in contrast with Austria-Hungary, which fairly vehemently turned down an offer to take over control of most of the Bosnian vilayet - they did exercise that option for predominantly Croat regions, largely due to complex reasons to do with the Chancellor Friedrich Ferdinand von Beust's reliance on Croat legislators (as led by Karl Sigmund von Hohenwart). When Hohenwart succeeded Beust, he unsurprisingly had even less of an interest in expanding Austrian influence into predominantly non-Catholic regions of Bosnia. Hohenwart was so loathe to tack onto Austria more territory - that he agreed at the Congress of Kiev to accept Madagascar as a protectorate instead of taking Bosnia.
During the First World War, the Serbs and Montenegrins took the Italian assumption in Albania as a golden opportunity - Serbo-Montenegrin forces flooded into Bosnia almost immediately. At this point, the Ottoman Empire had no actual borders with Bosnia. Originally, there was a sea route into Albania and then through a corridor into Bosnia - but the Italian assumption of control in Albania closed that route. Completely unrestricted, Serbo-Montenegrin quickly forced the surrender of the Ottoman garrison and took whatever they wanted. In contrast with most Christian conquests of Ottoman land - the conquest of Bosnia was somewhat less bloody and had less ethnic cleansing of Muslims than the others - largely because Ottoman resistance was so feeble. At the end of the war, as part of a compromise brokered by the British, the Serbo-Montenegrins were ordered to withdraw from regions of Bosnia without a significant Christian population (this was really just a face-saving proposal - since the pro-Austrian government in Serbia had already signed an agreement to create some sort of buffer state between Serbia and Austria). Most importantly - these lands connected Serbia and Montenegro - drawing the two nations closer together and giving Serbia a sea route access. In practice, this also denied one to Bosnia. Worst of all, rump Bosnia wasn't even contiguous - with one large region in Central Bosnia around Sarajevo - and another region in northwest Bosnia around Bihac.
At his point...the Ottoman Empire really had no interest in actually controlling Bosnia anymore - it was clearly just a liability, two land-locked enclaves in a sea of hostile Christian empires. Moreover, the Ottoman Empire had reached a true political crisis scenario in the aftermath of World War I - and was unlikely to be able to administer the region even if they wanted to. As a result - the new leader of the Ottoman Empire, Prime Minister Kamil Pasha, made the sensible decision to simply sell off Bosnia. The only real goal was to ensure that the buyer was a government - because the atrocities of Leopold II's Congo Free State made global governments pretty much refuse to consider selling territory to private individuals anymore. The only problem with his plan was...there weren't many buyers. The Austrians weren't interested. The Serbians and Montenegrins weren't either. That only left nations that would have no land or sea connection to Bosnia. The selling price, as expected, was not very high.
However, at the end of the day, there was one willing purchaser - a rising power eager to construct a colonial Empire - even as their last colonial empire went down in horrific flames. As a result, in 1897, the Confederate States of America, in the lame-duck term of President Patrick Cleburne (in what was widely referred to in North American newspapers as "Paddy's Folly"), paid a rather modest sum to the Ottoman Empire in order to acquire Bosnia. In practice, dealing with Confederate Bosnia largely fell to his successor, President James Longstreet, who realized that he needed a quick way to make Bosnia profitable without engaging in any actual atrocities. He settled on a Confederate official...who had excellent ties with wealthy American families...and was actually interested in taking on an assignment that pretty much every prominent person in the Confederate States was desperately trying to avoid being appointed to. As a result, the 38-year old Secretary of the Navy, Theodore Roosevelt, was appointed to be the first Governor of Confederate Bosnia, where he would eventually be known as the "American Pasha."