His comments came on the eve of the 99th anniversary of the mass deportation of Armenians in 1915.
Turkey denies Armenian claims that up to 1.5 million people were killed and that it constituted an act of genocide.
Mr Erdogan said the events of 1915 had "inhumane consequences," and expressed hope that those who died were at peace.
By Guney  YildizBBC World Service
Prime Minister Erdogan is not under political pressure in Turkey to apologise.
But by offering these unprecedented condolences, he will go down in history as the first Turkish prime minister to do so.
Previously, Mr Erdogan has gone a step further and apologised for the genocidal massacres against Dersim Kurds. He sees these killings as the crimes of secularist nationalists and does not link them to his government.
The Armenian government has yet to respond to the latest statement. But some think it will not change the status quo as it fell short of acknowledging the Armenian deaths as a massacre and accepting the Ottoman government's role.
Turkey's rapprochement attempt with Armenia collapsed just after it started in 2009. The border between the two countries has remained closed since 1993.
This statement needs to be accompanied by concrete actions to bring about a thaw in relations between the governments in Ankara and Yerevan.
Turkey maintains that many of the dead were killed in clashes during World War I, and that ethnic Turks also suffered in the conflict.
The exact nature of what happened remains highly contentious and has continued to sour relations between Turkey and Armenia.
In his message, Mr Erdogan stopped short of using the term "genocide" to describe the mass killings.
Mr Erdogan struck a conciliatory tone in his statement on Wednesday, in which he offered Turkey's condolences to the grandchildren of Armenians who lost their lives in 1915.
In the statement, which was translated into nine languages including Armenian, he described the events of World War I as "our shared pain".
"Having experienced events which had inhumane consequences - such as relocation - during the First World War, (it) should not prevent Turks and Armenians from establishing compassion and mutually humane attitudes among towards one another," he said.
He said "millions of people of all religions and ethnicities lost their lives in the First World War".
But he said it was "inadmissible" for Armenia to use the 1915 events "as an excuse for hostility against Turkey" and to turn the issue "into a matter of political conflict".
It is the first time a Turkish leader has formally offered condolences for the mass killings.
He also repeated calls to set up a joint historical commission into the events surrounding the killings - a request that has so far been denied by the Armenian authorities.
There has been a slight thaw in relations between Turkey and Armenia in recent years.
The governments of the two countries agreed to normalise relations in October 2009, but peace efforts have since stalled and the border remains shut.
Last year, Turkish Foreign Minister Ahmet Davutoglu called the 1915-16 events a "mistake" during Turkey's first high-level visit to Armenia in almost five years.
Armenia says up to 1.5 million people died in 1915-16 as the Ottoman empire split. Turkey has said the number of deaths was much smaller.
The killings are regarded as the seminal event of modern Armenian history, uniting one of the world's most dispersed peoples.
Most non-Turkish scholars of the events regard them as genocide.
Among the other states which formally recognise them as genocide are Argentina, Belgium, Canada, France, Italy, Russia and Uruguay. The UK, US, Israel and others use different terminology.
Armenians mark the date of 24 April 1915 as the start of what they regard as the genocide.
Correction, 14/05/2014: We added a line to say most scholars regard the events as genocide, to make clear that the weight of academic opinion concurs with that view.
Turkish PM Recep Tayyip Erdogan has offered condolences for the first time for the mass killings of Armenians under Ottoman rule during WWI.