He also blasted climate-change denial, race-based migration policies, unbridled capitalism and "strongman politics" - stances often cited as the hallmarks of Trump's controversial presidency. "I mean, we're violent, we're bullying".
"So, I think empowering more women on the continent-that right away is going to lead to some better policies", he added.
These days "we see much of the world threatening to return to a more unsafe, more brutal, way of doing business", Obama said, adding that politicians pushing the "politics of fear, resentment, retrenchment" are on the move "at a pace unimaginable just a few years ago".
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.
"You have to believe in facts", Obama said.
Obama, speaking to 15,000 people at a stadium in Johannesburg on Tuesday, gave an emotional address recalling the "wave of hope that washed through hearts all around the world" when Mandela was released from jail in 1990.
"If you start [by] saying it is an elaborate hoax, where do we start?"
Obama also touched on the issue of objective truth, decrying politicians who make up facts to pander to their supporters and feel no shame when called out for lying.
Without ever using his name, Obama delivered a repudiation of many tenets of President Donald Trump's regime, pillorying a politics of fear and hate in favor of one built on inclusion and acceptance.
Mandela was founding member of the ANC and an anti-apartheid activist who served 27 years in prison, spending many of these years on Robben Island.
She pointed out that Obama had cut off a meeting with India, a key Democratic ally, in order to attend a memorial service for the former king of Saudi Arabia. After Obama became president, he sent a copy of the photo to Mandela, who kept it in his office.
The former United States president met Mandela only briefly in 2005 but gave a eulogy at his funeral, hailing him as "the last great liberator of the 20th century".
As Trump on Tuesday again used Twitter to denounce "Fake News", a phrase he typically employs in response to negative coverage of his actions or rhetoric, Obama said that "the free press is under attack". So we have to stop pretending that countries that just hold an election where sometimes the victor somehow magically gets 90 percent of the vote because all the opposition is locked up or can't get on TV is a democracy.
The Duke and Duchess of Sussex, and Nelson Mandela's granddaughter Zamaswazi Dlamini-Mandela (2nd R), visit the Nelson Mandela Centenary Exhibition in London.
It was the second major speech from Obama in South Africa in two days after a previous stop-off in Kenya.
Imprisoned for almost three decades for his fight against state-sanctioned racial segregation, he was freed in 1990 and quickly set about working to unite the nation through forgiveness and reconciliation, becoming South Africa's first black president.