It is the first verdict he has received since his overthrow and is one of several trials he faces.
Morsi was deposed by the military in July 2013 following mass street protests against his rule.
Since then, the authorities have banned his Muslim Brotherhood movement and arrested thousands of his supporters.
Morsi and 14 other Brotherhood figures escaped a more serious charge of inciting the killing of protesters, which could have carried the death sentence.
Most of the other defendants were also given 20-year prison sentences. Morsi’s legal team have said they will appeal.
Morsi stood accused of inciting supporters to kill a journalist and opposition protesters in clashes outside the presidential palace in late 2012.
As crowds grew outside the palace, Morsi ordered the police to disperse them.
They refused, so the Muslim Brotherhood brought in their own supporters. Eleven people died in the ensuing clashes, mostly from the Brotherhood.
Hearing the verdict, Morsi and the other defendants gave a four-fingered salute, a symbol of the deadly clearance of Brotherhood supporters at the Rabaah al-Adawiya mosque in 2013.
A senior Brotherhood figure, Amr Darrag, called the ruling a “travesty of justice”.
“They want to pass a life sentence for democracy in Egypt,” he said.
Ramy Ghanem, a lawyer for one of those injured in the clashes, expressed surprise that Morsi escaped the more serious charge, but told the AFP news agency the sentences are “not bad”.
However the brother of one of the victims said he wanted to “enter the cage and pull out his [Morsi’s] intestines”, according to Reuters.
Morsi has rejected the authority of the courts, shouting during his first trial that he was the victim of a military coup.
On Monday, a court sentenced 22 Muslim Brotherhood supporters to death for an attack on a police station in Cairo, part of an ongoing crackdown against the Islamist movement.
Morsi was Egypt’s first freely-elected president, but protests began building less than a year into his rule when he issued a decree granting himself far-reaching powers.
A court dropped charges of conspiracy to kill protesters against Morsi’s predecessor, Hosni Mubarak, last year.