Accompanied by her husband, Kate, 30, appeared at the steps of the hospital smiling and holding a bouquet of yellow flowers. Neither she nor William spoke to waiting reporters before being driven way.
Kate, who married the second-in-line to the throne in April last year, has been suffering from Hyperemesis Gravidarum, an acute morning sickness which causes severe nausea and vomiting and requires supplementary hydration and nutrients.
There has been no announcement about when the baby is due, although the prince's spokesman has said Kate is less than 12 weeks pregnant.
Kate, known formally as the Duchess of Cambridge, will now recuperate at Kensington Palace, a royal residence in west London, her husband's office said.
"She is feeling better but now requires a period of rest," a royal spokeswoman said. "Their royal highnesses would like to thank the staff at the hospital for the care and treatment the duchess has received," the spokeswoman added.
The onset of the severe sickness and the need for Kate to go to hospital brought forward the announcement of her pregnancy, sparking a frenzy in the British media and even taking by surprise her grandmother-in-law, Queen Elizabeth, according to reports.
Bookmakers have been quick off the mark to lay odds on a name for the unborn baby, who will be third in line to the British throne after William and his father Charles.
The government is passing legislation in time for the birth to change historic rules of succession so that males no longer have precedence over a female sibling.
There has even been speculation that Kate could be carrying twins, as the acute sickness she is suffering is slightly more common in twin pregnancies.
World leaders including US President Barack Obama were swift to follow British Prime Minister David Cameron in sending their congratulations.