In a dangerous world, democracies cannot afford to alienate every nondemocracy. But any alliance with an autocratic regime requires at least a careful weighing of trade-offs. President Recep Tayyip Erdogan of Turkey has personified this dilemma for much of his 22 years in power. Turkey, at the crossroads of Europe, Asia and the Middle East, is an important American partner, with the second-largest military in NATO. The president of the European Commission, Ursula von der Leyen, said only that the arrest was “deeply concerning.” If elections were held today, Mr. Imamoglu would probably win, according to polls and political analysts. A self-described social democrat, Mr. Imamoglu, 54, is a member of the Republican People’s Party, which Mustafa Kemal Ataturk founded in 1919 Turkey’s drift toward Islamist extremism suggests that it could become another country that supports terrorism and threatens Israel. The most obvious potential for instability is in Syria,...