This is the first time officials have revealed why Nelson Mandela, 94, was rushed to a military hospital in the capital, Pretoria, on Saturday.
Tests showed a “recurrence of a previous lung infection”, presidential spokesman Mac Maharaj said.
Nelson Mandela is responding to his treatment, Mac Maharaj added.
News of the hospital stay has prompted much concern in South Africa.
The former president is regarded by most South Africans as the father of the nation, having inspired them to fight for democracy.
He led the struggle against white-minority rule before being elected the first black president in democratic elections in 1994.
Despite being imprisoned for 27 years by the apartheid government, after his release he forgave his former enemies and urged South Africans of all races to work together and seek reconciliation.
He was awarded the Nobel Peace Prize in 1993.
News that the frail Nelson Mandela has another lung infection is likely to generate considerable anxiety.
The officials who have visited Nelson Mandela in hospital since Saturday have all said he is doing well.
He was flown to hospital on Saturday from his home in Qunu village in Eastern Cape province by the military, which is responsible for his healthcare.
Local media reported that the decision to move him was taken so quickly that some family members and his own foundation were initially unaware of it.
But Mac Maharaj has repeatedly said that Nelson Mandela is doing well in hospital and there is no cause for alarm.
Nelson Mandela was last admitted to hospital in February when he was treated for abdominal pain.
In January 2011, he was treated for a serious chest infection.
While in prison in the 1980s, Nelson Mandela was also diagnosed with tuberculosis.
Nelson Mandela retired from public life in 2004 and has been rarely seen in public since.
j867rpfLHoUImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…