Judge Michael Huppert wrote that the measure was counter to "both the due process and equal protection provisions of the Iowa Constitution as not being narrowly tailored to serve the compelling state interest of promoting potential life." Huppert also cited several cases in federal court, including decisions in 2015 and 2016 in the St. Louis-based 8th U.S. Circuit Court of Appeals, indicating that such laws were unconstitutional.
The legal challenge by abortion providers Planned Parenthood of the Heartland and the Emma Goldman Clinic kept the law from taking effect last July.
Fetal heartbeats can be detected as early as six weeks into a pregnancy, making the Iowa law the most restrictive anti-abortion measure in the U.S.
"I am incredibly disappointed in today's court ruling, because I believe that if death is determined when a heart stops beating, then a beating heart indicates life," said Gov. Kim Reynolds, who signed the bill into law in May.
Republican Rep. Sandy Salmon, the main sponsor of the bill in the House, was disappointed the judge ended the case before it could be tried before a jury.
"He didn't even let it go to trial so that an unborn baby could be defended in court," she said.
She said she hopes the state appeals the ruling to the Iowa Supreme Court and she suspects Republicans will work on further legislation "to make corrections to what the courts have done."
Erin Davison-Rippey, Planned Parenthood's State Executive Director of Iowa, said the law was Reynolds' "egregious attempt to ban safe, legal abortions in Iowa."
"Planned Parenthood will continue to stand up for Iowa women and fight back against the Legislature's attacks on reproductive health. We will do all we can to make sure abortion continues to be safe and legal in our state -- no matter what," she said.
Senate Democratic Leader Janet Petersen said the decision sends a strong message to Iowa women that their constitutional rights are important, and that they, not politicians, should be making their health care decisions.
"The extreme law should have been overturned because it restricted the freedom of Iowa women and girls to care for their bodies and it forced motherhood on them," she said.
The providers argued in court in December that the law is "blatantly unconstitutional under clear Iowa law." Planned Parenthood attorney Alice Clapman said courts in several states that recognize abortion as a fundamental right -- including North Dakota, Arkansas and Mississippi -- have dismissed similar abortion bans before trial.
The Iowa Supreme Court in June struck down an earlier law that required a 72-hour waiting period for women seeking an abortion, ruling that the restriction was unconstitutional and that "autonomy and dominion over one's body go to the very heart of what it means to be free."
Attorney Martin Cannon argued for the state that the bill is extremely narrow in focus by saying a beating heart signifies life in a fetus and that human life must be protected once an abdominal ultrasound identifies the heartbeat rhythm.
He didn't immediately reply to a message seeking comment.
Cannon said the bill does not prevent an abortion but pushes women to get one sooner in the pregnancy. He argued there are too many disputed issues to be heard at trial and the judge should not end the lawsuit.
The Associated Press contributed to this report.