This article is more than
6 year oldShe said the "dungeon is really something that people should see and experience" and "what happened so many years ago is really a tragedy".
People were kept naked and chained in the 17th Century Cape Coast Castle, waiting to be shipped as slaves.
Mrs Trump's African tour will include Kenya, Malawi and Egypt and is intended to promote children's welfare.
President Donald Trump has not visited Africa since taking office in January 2017.
In February, a row broke out after he allegedly used "shithole" to describe some African nations.
Mrs Trump's week-long trip to the continent is seen as helping to heal some of the divisions.
The highlight on Wednesday was her tour of Cape Coast Castle, a major outpost on the Atlantic slave trading route.
She first paid a courtesy visit to a local traditional ruler, Osabarimba Kwesi Atta II, meeting him in Obama Hall, named after former US President Barack Obama.
Mr Obama, the first African American president, visited the castle in 2009, with his wife, Michelle, a descendant of African slaves, and their two daughters.
After being shown around the castle and given a history lesson about it, Mrs Trump said: "It's very emotional. I will never forget [the] incredible experience and the stories that I heard."
On Tuesday, Mrs Trump visited, alongside Ghana's First Lady Rebecca Akufo-Addo, the Ridge Hospital in the capital, Accra.
Mrs Trump observed babies being weighed as part of a project aimed at promoting nutrition in children, which is supported by funding from the US government's foreign aid organisation, USAid.
By Thomas Naadi, BBC Africa, Cape Coast Castle
The castle is one of the many historical trading posts dotted along the West Africa coast. During the Trans-Atlantic slave trade, tens of thousands of enslaved Africans were held here under degrading and inhuman conditions before being shipped to the Americas.
Some of them were kidnapped and exchanged for items like alcohol and guns. The castle was originally used as a trading post for goods like gold and timber.
In 2009, Mr Obama described the castle as a remnant of profound suffering and a reminder of the human capacity to commit great evil.
It stands as an important signifier of the starting point of African American history.
Ahead of her trip Mrs Trump said that she was looking forward to visiting "four beautiful and very different countries in Africa".
"She is interested in Africa because she has never been before and knows that each country will have its own unique history and culture." Stephanie Grisham, her communications director, said.
Mrs Trump said that she was looking forward to seeing how the US can continue working together with Malawi to support a USAid programme that is focused on children's education.
The first lady also highlighted the work the US was doing in Kenya to support early-childhood education, wildlife conservation and HIV prevention.
"My final stop, which is Egypt, will focus on the country's tourism and conservation projects," she said.
Mrs Trump has got a warm reception, but huge crowds have not lined the streets to welcome her, as they did for the Obamas.
Views about the visit have been mixed. "I think Melania is a great woman. Her story is particularly inspiring," one resident of Accra told the BBC.
But another said "she doesn't inspire me" comparing her unfavourably to former First Lady Michelle Obama, who travelled to Ghana with her husband on a trip in 2009.
Before his wife left for Africa, Mr Trump told reporters: "We both love Africa. Africa is so beautiful. The most beautiful part of the world, in many ways."
This view is at odds with comments he allegedly made in a private discussion in February.
Mr Trump was accused of racism, after he was reported to have used the word "shithole" to refer to African nations when talking about immigration policy.
The African Union asked him to apologise over the comment.
He later told reporters: "I am not a racist. I'm the least racist person you have ever interviewed."
In August the president angered the South African government by falsely claiming that there was large-scale killing of white farmers in South Africa.
I have asked Secretary of State @SecPompeo to closely study the South Africa land and farm seizures and expropriations and the large scale killing of farmers. “South African Government is now seizing land from white farmers.” @TuckerCarlson @FoxNews
— Donald J. Trump (@realDonaldTrump) August 23, 2018
The South African government reacted swiftly to refute Mr Trump's assertion that white South Africans were being targeted.
President Trump has not paid much attention to the continent, but has welcomed three African leaders, the presidents of Egypt, Nigeria and Kenya, to the White House.
When Rex Tillerson, Mr Trump's first secretary of state, visited Africa in March he said the themes of his trip were counterterrorism, democracy, governance, trade and investment.
Mr Tillerson warned Africa of China's economic engagement with the continent which he said encouraged dependency, utilised corrupt deals and endangered its natural resources.
He also announced a $533m (£380m) humanitarian African aid plan.
On the counterterrorism front, Mr Trump's administration has escalated the fight against Islamist militants in the Sahel region and in Somalia.
The US has set up a drone base in Niger which is operated by the CIA.
Newer articles
<p>The two leaders have discussed the Ukraine conflict, with the German chancellor calling on Moscow to hold peace talks with Kiev</p>