Prime Minister Hazem el-Beblawi had ordered that Mubarak be put under house arrest as part of the emergency measures imposed this month after a wave of violence sparked by the ouster of Islamist leader Mohammed Morsi, who had succeeded Mubarak as Egypt's first freely elected President.
Thursday's move followed a court decision ordering the release in relation to charges of receiving gifts from a state-owned newspaper.
The release threatened to stoke the unrest as the Arab nation is already roiled in a crisis over a military coup against Morsi.
But the decision to place him under house arrest instead of letting him go free appeared designed to ease some of the criticism over releasing Mubarak and to ensure that he appears in court next week for a separate trial.
Despite his release, the 85-year-old ousted leader still faces retrial on charges of complicity in the killing of protesters in the 2011 uprising against him, which could put him back behind bars. His court case resumes next week. He also is being investigated in at least two other corruption cases.
State TV said a medically equipped helicopter transported Mubarak to the military hospital in the southern Maadi suburb.
Footage on private TV stations showed the helicopter carrying Mubarak arrived at the pad outside the military hospital, on the banks of the Nile. He was immediately transported to an ambulance, heavily guarded, and moved across the street to the hospital. Mubarak was not seen during the transport.
Mubarak was held for several weeks of his two years detention in the same hospital as he underwent medical check-ups. His lawyers had cited bad conditions in the prison facilities. Prison authorities had renovated a ward where he was later kept.
Since his ouster, Mubarak's supporters have released conflicting details about his health, including that he suffered a stroke, a heart attack and at times went into a coma. His critics called these an attempt to gain public sympathy and court leniency.
His wife, Suzanne, has been living in Cairo and keeping a low-profile, occasionally visiting Mubarak and their two sons in prison.
The prospect of Mubarak being freed, even if only temporarily, would feed into the larger crisis bedeviling Egypt: the violent fallout from the July 3 coup that unseated Morsi.