"That is why we must listen to one another, and seek common ground," he said.
The president also reiterated that the US government strongly supported Turkey's bid to become a member of the European Union.
"Europe gains by diversity of ethnicity, tradition and faith - it is not diminished by it," he said to a round of applause from the audience. "And Turkish membership would broaden and strengthen Europe's foundation once more."
The EU agreed to open accession talks with Ankara in 2004, but in recent years Turkey has made little progress with democratic reforms which would improve its chances of membership, correspondents say.
Later in his address, Mr Obama said the US strongly supported the full normalisation of relations between Turkey and Armenia.
At his earlier news conference with President Gul, he had stood by his 2008 assertion that the killing of Armenians by Ottoman Turks in 1915 constituted "genocide" - without repeating the word.
Several groups have been demonstrating against the visit
The issue remains highly sensitive between the governments of Armenia and Turkey, which denies those killed were victims of systematic genocide, and has prevented normal relations between them for many years.
During his election campaign, Mr Obama said the "Armenian genocide is not an allegation, a personal opinion, or a point of view, but rather a widely documented fact supported by an overwhelming body of historical evidence".
After his speech, Mr Obama was due to meet Prime Minister Recep Tayyip Erdogan. The US leader will then leave Ankara for Istanbul, where he will attend the Alliance of Civilizations forum.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.