Mr Odinga said his withdrawal would give the electoral commission enough time to introduce reforms that will help deliver a more credible election.
The Supreme Court annulled the result of the original 8 August poll, which saw Uhuru Kenyatta declared winner, after finding irregularities.
But Mr Kenyatta says he is ready to proceed with the new vote as planned.
The country’s electoral commission said Mr Kenyatta had won the August vote by a margin of 1.4 million votes – or 54% of the total, compared to Mr Odinga’s 44%.
Kenya’s vice-president, William Ruto, has now called on the commission to declare Mr Kenyatta president as a result of Mr Odinga’s announcement.
The election re-run was due to take place on 26 October, but Mr Odinga said on Tuesday: “We have come to the conclusion that there is no intention on the part of the IEBC [electoral commission] to undertake any changes to its operations and personnel… All indications are that the election scheduled for 26 October will be worse than the previous one.”
As a result, he said, “considering the interests of the people of Kenya, the region and the world at large” it was best that he withdrew from the race.
Mr Odinga’s coalition party believes the election will have to be cancelled as a result of his withdrawal, allowing “adequate time to undertake the reforms necessary to conduct an election that is in strict conformity with the constitution, the relevant laws and the constitution”.
But Mr Kenyatta, speaking at a rally in the southern town of Voi, said: “We have no problem going back to elections. We are sure we will get more votes than the last time.”
He added: “We are also telling him it is the people’s right to choose their leader. It is their sovereign right to choose their leader of choice.”
By Dickens Olewe, BBC News
The withdrawal could be a strategy for Raila Odinga to exit the political scene on his own terms.
The annulment of President Uhuru Kenyatta’s victory in the 8 August election was a much-needed political high for Mr Odinga.
He felt vindicated for challenging the election and pushed for changes to the electoral system as a condition for his participation in the re-run.
The electoral commission has rejected the changes he demanded, largely because of contractual agreements with the companies providing key services for the election.
With President Kenyatta’s party having won a majority of MPs in both houses of parliament, it is likely that Mr Odinga was headed for another defeat and that would be too much for a man, who has been nicknamed the enigma.
The legal consequences of Mr Odinga’s withdrawal are unclear.
Constitutional lawyers disagree on the way forward and whether the 26 October election can still take place and if, despite his withdrawal, Mr Odinga will still be on the ballot.
Although many Kenyans are jaded by the never-ending political drama, they will now have to belt-up for a drive further into unchartered territory.
Mr Odinga’s opposition coalition – the National Super Alliance (NASA) – has previously made clear its participation in the election was contingent on reforms being made.
But Kenya’s Independent Electoral and Boundaries Commission (IEBC) says it has made the necessary changes.
Prominent opposition senator James Orengo has called on people to protest on Wednesday, using the slogan “no reform, no elections”.