The Istanbul - Sofia Express (İstanbul-Sofia Ekspresi), with a connection to Bucharest, Romania, is the only scheduled train between Turkey and European countries.
It departs from Halkalı, 28 km (17 miles) west of Istanbul's city center (map), on its route to Dimitrovgrad, Bulgaria, where the train divides. Some passenger and couchette cars continue from Dimitrovgrad to Plovdiv and Sofia, Bulgaria, other passenger, couchette and sleeping cars go to Ruse and Bucharest, Romania.
At Sofia you can connect with the Balkan Express to travel to Belgrade, and from there you would transfer to another train to reach central and western Europe.
It's a long haul, but adventurous travelers may prefer it because it's a real travel experience rather than merely speeding quickly from one location to another.
In recent years the train equipment and standards have been improved. According to Mark Smith, the dean of European train travelers known as The Man in Seat 61, the journey is safe, comfortable, and a fine train experience. More...
Here's the schedule on the Turkish State Railways website.Fares are in avro (euros).