Large numbers have joined the march since it began in Ankara on 15 June.
Opposition and protest leader Kemal Kilicdaroglu criticised the wave of arrests and imprisonments that followed last year's failed coup.
President Erdogan has accused the marchers of supporting terrorism.
He said the Mr Kilicdaroglu's Republican People's Party (CHP) - which has organised the march - had gone beyond political opposition and was "acting with terrorist organisations and the forces inciting them against our country".
The rally was the biggest show of defiance against President Erdogan since the Gezi Park protests four years ago.
Mr Kilicdaroglu accused the government of taking advantage of the coup attempt on 15 July last year to seize the authority of parliament and pass executive, legislative and judicial powers to one man.
He said the rally marked "a new birth".
"Nobody should think this march is the last one. It's the first step!" he said.
He launched the march after one of his MPs, Enis Berberoglu, was arrested for allegedly leaking documents purporting to show that the government was arming jihadists in Syria.
Mr Berberoglu denies the charge. Sunday's rally drew a sea of people to an area close to the jail in which he is being held.
More than 50,000 people have been arrested and 140,000 dismissed or suspended during a state of emergency in place since last year's attempted military takeover.
The detentions of human rights activists and leading journalists have drawn international condemnation.
Mr Kilicdaroglu, who has walked around 20km a day for the past three weeks, condemns the coup attempt but says the purges and emergency rule by Mr Erdogan constitute a "second coup".
He told crowds at the rally: "We marched for justice, we marched for the rights of the oppressed. We marched for the MPs in jail. We marched for the arrested journalists.
"We marched for the university academics dismissed from their jobs. We marched because the judiciary is under a political monopoly."
The failed coup last July saw rogue soldiers bombing government buildings and driving tanks into civilians, killing more than 260.
The BBC's Mark Lowen in Istanbul says there is a widespread feeling that the government has seized the chance to crush all opponents, not just alleged coup supporters.
Hundreds of thousands of people have gathered in Istanbul at the end of a 450km (280-mile) "justice" march against the government of Turkish President Recep Tayyip Erdogan.