Obama rallied the crowd in Johannesburg to respect human rights and keep Mandela's ideas alive, at a time of threats to tear down what's been built over the last few decades.
"Given the strange and uncertain times we are in -- and they are strange, and they are uncertain -- each day's news cycles bringing more head spinning and disturbing headlines," Obama said.
Mandela died in 2013 after a leading lifelong fight against apartheid and a 27-year imprisonment before he was elected South African leader in 1994. His birthday, July 18, is celebrated annually around the world as a remembrance of peace and reconciliation.
Obama reflected on times of the past when powers of the world viewed certain nations, certain races and certain groups as "apparently superior and violence and corruption was the primarily basis for governments," when "the strong unnecessarily exploited the weak, wealth was determined primarily by conquest ... women were subordinate to men, and privilege and status was bound by color."
"Even in the United States, founded on the declaration that all men are created equal, racial segregation and discrimination was a law in almost half the country and the norm in throughout the rest," he continued. "It's hard to overstate the changes that have taken place since that time."
Obama talked about how Mandela's leadership and long walk to freedom and justice signified something better was on the horizon.
"He came to embody the universal aspirations of people all around the world and gave hope for a better life," he said.
"Dictatorships began to give way to democracies. The march was on. The respect for human rights, the rule of law, in a declaration by the United Nations, came the guiding of norm for the majority of nations."
With the geopolitical changes came sweeping economic changes, then scientific breakthroughs, new infrastructure, reduction of armed conflicts and "suddenly millions of people were lifted out of poverty," Obama said. "Once starving nations were able to feed themselves, infant mortality rates plummeted."
He also spoke about the spread of new technology and how the Internet is connecting cultures, even the most remote countries.
"All of that progress is real. And now an entire generation has grown up in a world by most measures that has gotten steadily freer, healthier, wealthier, less violent and more tolerant during the course of their lifetimes," he said.
Obama's speech came one day after President Donald Trump met Russian leader Vladimir Putin in Finland and spurred outcry among lawmakers and government officials in the United States.
"We now see much of the world threatening to return to an older, more dangerous more brutal way of doing business," Obama said.
"Racial discrimination still exists in the United States and South Africa. And women and girls still continue to be blocked from position of power and authority, suffer as victims of abuse and are getting paid less than men for doing the same work," he continued. "Far too many people know the more things have changed the more things have stayed the same."
Obama closed by saying "now is a good time to be fired up."
"For this of us who care about the legacy we honor here today, we stand on the shoulders who came before, they know it's now their turn to do the work," he said. "People must learn to hate and if they can learn to hate they can be taught to love. For love comes more naturally to the human heart."