The casualties are the first for Turkey since the launch of Operation Euphrates Shield to rid the border region of terrorists on Wednesday.
Speaking on condition of anonymity due to restrictions on talking to the media, the official said rockets were launched at two Turkish tanks operating 7 kilometers (4 miles) south of Jarabulus, the northern Syrian city freed from Daesh.
The source said fighters from the PYD carried out the attack. The group is affiliated with the PKK terrorist organization, which has waged war on Turkey since 1984.
Turkish forces retaliated with artillery fire, the source added, and military helicopters airlifted the soldiers to hospitals in Turkey's Gaziantep province.
Euphrates Shield saw the Turkish military back the Free Syrian Army with artillery, tanks, air power and special forces in taking Jarabulus, which lies to the west of the Euphrates River and around a kilometer (mile) to the south of the Turkish border. Aircraft from the anti-Daesh coalition also backed the operation.