Germany is a sovereign state, so it can pass a law:
Any Turkish citizen who votes in the Turkish Elections while resident in Germany is subject to losing their German citizenship and deportation.
Now, you can't stop a person from visiting their embassy, and it might not be easy to be certain that a person voted or not. But a draconian law like that should effectively stop people from voting - who would want to risk their home and livelihood if found out?
But this is cloud-cuckoo land! It goes against 70 years of democratic traditions in Germany and would require a change to the Basic Law of Germany (the equivalent of the Constitution). Democratic countries might have opinions about the leaders of foreign countries, but they don't deprive people of their democratic right to vote. It is probably a violation of the International Covenant on Civil and Political Rights - so breaks international law. It could result in Germany being removed from the EU. So it is not done not because it is impossible, but because every major party in Germany support the right to vote.