https://sv.ivisa.com/turkey-turkish-visa You have to exit customs and immigration so as to board a connecting flight, and so you have to have the ability to join the nation. Otherwise, you'll have to cover the transport service every time you return to the embassy. In that situation, you don't need to apply to get a visa unless you're spending the night on shore.