He was flown out by helicopter from Tora prison in Cairo – but is now expected to be put under house arrest.
The 85-year-old is being retried on charges of ordering the killing of protesters during the 2011 uprising that led to his downfall.
That retrial opened in May but Mr Mubarak has now served the maximum amount of permitted pre-trial detention.
Egypt’s prime minister said the former leader would be placed under house arrest when he is released from prison following more than two years in detention.