He is the first sitting US president to visit since the 1959 revolution, which heralded decades of hostility between the two countries.
Mr Obama said change would happen in Cuba and that Cuban President Raul Castro understood that.
The two leaders met to talk about trade and held a joint news conference.
Mr Castro denied that there are political prisoners in Cuba, telling journalists to "give him a list" and then they would be released "tonight".
He also defended Cuba's record on human rights and pointed to problems in the US.
"We defend human rights, in our view civil, political, economic, social and cultural rights are indivisible, inter-dependent and universal," Mr Castro said.
"Actually we find it inconceivable that a government does not defend and ensure the right to healthcare, education, social security, food provision and development."
Mr Obama said the trade embargo would be fully lifted in Cuba, but he could not say exactly when.
"The reason is what we did for 50 years did not serve our interests or the interests of the Cuban people," he said.