The leaders of both countries also discussed ways to strengthen political and economic relations.
Turkish President Recep Tayyip Erdogan arrived in Saudi Arabia on the second leg of his visit to the Gulf region.
Erdogan met with Saudi King Salman bin Abdulaziz and the Saudi Crown Prince to discuss the future of Syria. The two countries have supported different opposition groups during the country's conflict that has lasted almost six years.
They both say they will take part in rebuilding the country once the war ends.
During the meetings, both countries also focused on strengthening political and economic relations.
Saudi Arabia is Turkey's close ally in the region and they have become increasingly close over the past year, sharing in particular a backing for the opposition in Syria's war.
Before beginning his Gulf trip from Bahrain on Sunday, Erdogan said Turkish troops and their Syrian rebel allies had entered the centre of al-Bab, the last stronghold of Daesh in the northern Syrian province of Aleppo.
TRT World's Hasan Abdullah has more details from the Saudi capital Riyadh.