The spiritual leader of the world's 1.3 billion Catholics was invited by King Mohammed VI for the sake of "interreligious dialogue", according to Moroccan authorities.
In a joint statement, the two leaders said Jerusalem al-Quds was "common patrimony of humanity and especially the followers of the three monotheistic religions."
"The specific multi-religious character, the spiritual dimension and the particular cultural identity of Jerusalem... must be protected and promoted," they said in the declaration released by the Vatican as the pontiff visited Rabat, AFP reported.
The Moroccan king chairs a committee created by the Organisation of Islamic Cooperation to safeguard and restore Jerusalem's religious, cultural and architectural heritage.
The joint statement came after US President Donald Trump's recognition of the disputed city as capital of the Zionist regime, which sparked anger across the Muslim world, especially from Palestinians who see Jerusalem as the capital of their future state.
Improving relations with other religions has been a priority for the Argentine pontiff, whose papacy has been marred by clergy facing a wave of child abuse allegations.
Addressing thousands of Moroccans who had braved the rain to attend the welcome ceremony, Francis said it was "essential to oppose fanaticism".
He stressed the need for "appropriate preparation of future religious guides", ahead of meeting trainee imams later on Saturday.
Catholics are a tiny minority Morocco, where 99 percent of the population is Muslim.
Speaking at the ceremony at the Tour (or tower) Hassan mosque and nearby mausoleum in Rabat, the monarch also voiced opposition to radicalism.
"That which terrorists have in common is not religion, it's precisely the ignorance of religion. It's time that religion is no longer an alibi... for this ignorance, for this intolerance," he said.
Francis rode to the ceremony in his Popemobile, passing rows of Moroccan and Vatican City flags and an estimated 12,000 well-wishers who packed the esplanade.
Buildings had been repainted, lawns manicured and security stepped up ahead of the first papal visit to Morocco since John Paul II in 1985.
A 17-year-old was arrested after trying to throw himself onto the king's limousine to seek the monarch's help, the police said.
Some 130,000 people across Rabat watched the first stage of the pope's visit, which was beamed onto giant screens, officials said.
'Right to a future'
After stopping by the royal palace, Francis and Mohammed visited an institute where around 1,300 students are studying to become imams and preachers.
There they heard from a French and a Nigerian student of the institute, which teaches "moderate Islam" and is backed by the king.
On Sunday, the pope will celebrate mass at a Rabat stadium with an estimated 10,000 people attending.