"I have decided to send back to parliament, therefore, to veto the law on the Supreme Court, as well as the law on the National Council of the Judiciary," Duda said on Monday, July 24.
"This law would not strengthen the sense of justice," he said in a statement which was carried on Polish television.
Opponents of the controversial law say it is undermining the principle of an independent judiciary.
The bill is sponsored by the ruling Law and Justice party. It gives parliament the power to fire the current Supreme Court judges and replace them with judges it nominates.
European Union leaders have criticized the bill for impairing judicial independence and threatening the rule of law.
Earlier in July, the European Commission's vice president, Frans Timmermans, said they could even take the rare step of removing voting powers from a member state.
Pleased that the voices of millions were heard with @AndrzejDuda's veto of proposed change to constitutional court — @giannipittella #Poland pic.twitter.com/l2SbGxJZDW
— S&D Group (@TheProgressives) July 24, 2017
President Duda's spokesman, Krzysztof Lapinski, said he saw flaws in the legislation.
Mr. Lapinski said Mr. Duda, who had 21 days to sign the legislation into law, saw inconsistency between two articles regarding the appointment of the court's head.
Mr. Duda, a former Law and Justice Party MEP, had towed the party line up until now.
Earlier in July, the Polish parliament introduced legislation which allowed it to nominate judges on the National Council of the Judiciary (KRS), the body which appoints judges across the country.
Prime Minister Jaroslaw Kaczynski and his Law and Justice Party control the parliament in Warsaw and could effectively appoint judges.
In a heated debate on Tuesday (July 18) Mr. Kaczynski accused the opposition of being "rats," who were responsible for killing his brother, former president Lech Kaczynski, who died in a plane crash in 2010.
"These are fundamental reforms that deeply transform our political system. The process lacks transparency, the drafts were not properly opened to opinions before proceeding. They violate the constitution in number of ways," said Ewa Letowska, a former Supreme Court judge.
The European Commission said on Wednesday (July 19) it was launching a sanction procedure against Poland.
📺What are the @EU_Commission concerns about the independence of the judiciary in #Poland? All you need to know explained by @TimmermansEU ⬇️ pic.twitter.com/l4uvOpKLUH
— European Commission (@EU_Commission) July 19, 2017
The Commission's Vice President Frans Timmermans said the EU was "very close" to triggering Article 7, a sanction which has never been used before and would suspend Poland's voting rights in the council of ministers.
Recent measures taken by the Polish authorities on the judicial system greatly amplify the threat to the Rule of Law in Poland
— Frans Timmermans (@TimmermansEU) July 19, 2017
Mr. Timmermans said Mr. Kaczynski's plans would "put the judiciary under full political control of the government."
Earlier this year, the EU warned Poland not to press ahead with the legislation. It followed a warning first issue in July last year. Rafal Trzaskowski, an MP with the opposition Civic Platform party, said Mr. Kaczynski's government was now a pariah.
"It's absolutely clear that patience is running out, not only in the European commission, but also in many European capitals," he said.
"The initiation of Article 7 would be unprecedented, and it would show quite clearly how marginalized the current government is in the European Union," he added.
But Article 7 can only be passed if it is approved unanimously and Mr. Kaczynski's close ally and ideological soulmate, Viktor Orban of Hungary, has said he would veto such a step.