The Nobel peace laureate's health has declined in recent years and he rarely appears in public.
Mr Mandela is due to be discharged from hospital by Monday, officials said.
On Saturday night he was said to be in a stable and comfortable condition.
Earlier, President Jacob Zuma said in a statement that Mr Mandela "has had a long-standing abdominal complaint and doctors feel it needs proper specialist medical attention".
He later said that Mr Mandela had undergone a planned, undisclosed procedure.
He said Mr Mandela - affectionately known in South Africa by his clan name, Madiba - was "fully conscious".
"The doctors are satisfied with his condition, which they say is consistent with his age. We are happy that he is not in any danger."
It was not revealed which hospital the former leader was being treated in, however journalists set up camp outside a military hospital in the capital, Pretoria.
Mr Mandela spent 27 years in prison for fighting apartheid rule and became South Africa's first black president in 1994, serving one five-year term.
His home is in Qunu, a small rural village in South Africa's Eastern Cape Province where he was raised.