Speaking with reporters on Air Force One during the flight from Dakar, Senegal, Obama said no decision had been made on a meeting with Mandela.
The 94-year-old former South African President has been hospitalized for three weeks with a serious lung infection.
"So when we get there we'll gauge the situation, but I think the main message we'll want to deliver if not directly to him but to his family is simply our profound gratitude for his leadership all these years and that the thoughts and prayers of the American people are with him, and his family, and his country," Obama said. "I think in that sense, the sentiment of Americans is universally shared around the world."
Before leaving Senegal, Obama said a U.S. initiative has helped increase income for African farmers and reduce hunger but "far too many Africans" are still in poverty.
Speaking after a Food Security Expo in Dakar, Obama said the Feed the Future initiative, begun during his first term as president, has "helped 7 million small farmers harness new techniques."
"We've boosted the value of their goods that they sell by more than $100 million, and that means higher incomes for farmers and more opportunities for farmers," he said.
The president said farmers are not only improving their own lives but are also "starting to hire people and you're suddenly starting to see growth in these rural communities that makes all the difference for a country like Senegal."
Obama said economic progress across Africa has raised incomes, reduced poverty rates and led to a growing middle class, but he said nearly 900 million people worldwide suffer from chronic hunger and food insecurity.
"At the same time, far too many Africans still endure the daily injustice of extreme poverty and hunger," he said.
South Africa is the second stop of Obama's second visit to sub-Saharan Africa since taking office. He finishes Monday in Tanzania.
The White House said the trip was meant to improve investment opportunities for U.S. businesses, address development issues such as food security and health, and promote democracy.
Mandela, a Nobel Peace Prize laureate, became internationally known while spending 27 years in prison for fighting South Africa's system of racial segregation. He was elected president in 1994, four years after he was freed.
Obama's visit to South Africa will include a stop at Robben Island, where Mandela spent a majority of his time in prison. The schedule released by the White House did not list a visit with Mandela.