They'll be held for 15 days pending an investigation into accusations of corruption and abuse of authority.
The move was brought by enormous public pressure on the ruling military, which was handed power when Mubarak stepped down on Feb. 11.
The announcement is the latest in a series of inquiries against top former regime officials and came just hours after the former president was hospitalized with heart problems. It is believed Mubarak will remain in the hospital during his detention.
Protesters gathered late Tuesday outside the hospital where Mubarak is being treated. Some protesters denounced the former president, carrying signs calling him a butcher.
Protesters had pushed hard for Mubarak's prosecution, demanding what they called a clear signal that the corruption that pervaded his nearly 30-year rule would be definitively broken.
Public outrage was widespread over allegations that large fortunes were skimmed off by top regime officials through shady deals over the years.
Beyond the anger has been the fear that Mubarak cronies are maneuvering to regain power as the country tries to work out democratic rule - and that the ruling military was not taking action to prevent them, or was even abetting them.
The Associated Press contributed to this report.