The match between the two stars will take place at Jeddah's King Abdullah Sports City on December 22.
"Thanks for the invitation and looking forward to playing and visiting for the first time," Nadal said on Twitter.
Nadal, the reigning French Open champion, has 17 Grand Slam titles to his name.
Former world number one Djokovic, now at three in the rankings, won Wimbledon and the US Open this year to take his majors collection to 14.
Djokovic and Nadal have played 52 times in their careers with the Serb leading their head-to-head 27-25.
Saudi Arabia has hosted a series of international sports events in recent months.
The first women's professional squash tournament took place in January while last month saw Britain's Callum Smith knock out compatriot George Groves in a World Boxing Association super middleweight boxing bout in Jeddah.
The moves are seen as part of Prince Mohammed bin Salman's drive to open up the conservative kingdom after being named heir to the throne in June 2017.
But despite moves by the young prince to modernise the economy and society -- including lifting a ban on women driving -- the country has stepped up repression of religious, intellectual and feminist dissidents.
Mystery also surrounds the fate of Saudi journalist Jamal Khashoggi, who has been missing since entering the kingdom's Istanbul consulate on October 2.