The 67-year-old Islamist had just addressed the court on Monday, warning that he had "many secrets" he could reveal, a judicial official told the Associated Press.
A few minutes later, he collapsed and died in a glass defendants’ cage. He was known to suffer from diabetes and high blood pressure.
Morsi was buried in Cairo in the presence of some family members, one of his lawyers said early Tuesday.
In his final comments, he continued to insist he was Egypt's legitimate president.
Morsi's Muslim Brotherhood accused the government of "assassinating" him through years of poor prison conditions. In a statement, the group demanded an international investigation into Morsi's death and called for protests outside Egyptian embassies across the world.
Turkey’s President Tayyip Erdogan said Morsi was “a martyr who lost his life while he fought for the cause he believed in.”
“History will never forget the tyrants who put him in prison, threatened him with death penalty and caused his martyrdom,” he said.