Surprised Germany didn't invade, then.
Turkey was saved by her position and hitlers impatience
In 1939, the Turkish leadership was careful to tread a careful path of neutrality, concluding treties with both sides, purchasing military equipment from both sides and observing rules of neutrality.
Throughout 1939 and 1940 the germans were pre-occupied in achieving some of their critical war aims. It was essential that they defeat the western allies and with the single major exception of the boB they were largely successful. In the Balkans and North Africa, a free hand was given to the Italians who suffered losses and heavy defeats, but this was not foreseen at the time. Germany's involvement in the Balkans and North Africa was grudging and never seen as more than a holding action by them. They were unwilling to put large resources into this TO, despite some hard lobbying by some like Raeder to do just that. The last thing they wanted to do in the lead up to Barbarossa was to open up yet another TO that would drain their reserves and dissipate their forces. Moreover, in the upcoming battle of annihilation expected in the opening rounds against the SU, they did not envision deep inroads into Russian territory. Certainly not as far as the Caucasus.
The turks were aware of this and feared a soviet war more than they feared a german invasion. They had lost more than a million men in their war with the Russian in WWI and expected similar outcomes if they joined the war against Stalin.
Moreover, after 22 June the Germans were not in a position to economically influence the turks.after their treachery with the Soviets they ran their economy on looted resources and an artificial cash exchange rate that heavily favoured Germany. Turkey remained committed to exporting raw materials to Germany, mostly in exchange for goods instead of cash, but increasingly her trade swung to the allies as their terms of trade were far more equitable
The Germans did conclude a four year non-aggression pact with Turkey from 18 june 1941, which lasted about as long as it took for the Soviets to drive the Germans out of the Balkans. In late 1944 the turks terminated their economic agreements with Germany, and in early 1945 they finally declared war on the rogue state.
It was not all plain sailing with the allies. The British in particular got testy with Inonu. The allies were failry justified to be annoyed. By early 1944 they had nearly motorized the entire army, provided some thousands of tanks to them as well as vast amounts of aircraft as incentives to join the allies. It was to no avail, and I have to agree with the turks that their best course of action was to stay out of it for as long as they could