The soldiers were supporting Syrian rebels in efforts to capture the city of al-Bab from so-called Islamic State.
It is part of a broader offensive by Turkey to push IS and Kurdish fighters away from Turkey's southern border.
Russia and Turkey, who back opposing sides in the war, have been jointly targeting IS in air strikes recently.
A Russian aircraft attacked a building where some of the soldiers had been deployed near al-Bab, the Turkish military said.
It had been planning to hit IS targets but "by accident three of our soldiers were martyred when a building was bombed where our units were", it added.
Eleven other soldiers were wounded in the friendly fire incident on Thursday.
The Kremlin has issued a statement (in Russian) saying President Putin had, in a telephone call with his Turkish counterpart, "expressed condolences over a tragic incident which resulted in the deaths of several Turkish troops in the al-Bab area".
The incident comes after a warming of ties between the two countries, which had previously been strained after Turkey downed a Russian jet near the Syrian border two years ago.