Iowa's Republican-controlled legislature passed the restriction in May 2018 which outlawed the procedure after a fetal heartbeat is detected, at about six weeks and often before a woman realizes she is pregnant.
In that ruling posted online, District Court Judge Michael Huppert wrote, "It is undisputed that such cardiac activity is detectable well in advance of the fetus becoming viable."
A fetus that is viable outside the womb, usually at 24 weeks, is widely considered the threshold in the United States to prohibit abortion.
The district court decision is a victory for supporters of abortion rights, but abortion opponents have vowed to take the fight to Iowa's appellate courts, the Des Moines Register and other media reported.
Iowa state Sen. Janet Petersen of Des Moines, the Democrats' leader in the Iowa Senate, praised the ruling.
“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 told the Register. "The governor and legislative Republicans should stop attacking women’s health care."
Proponents of the law had expected a long court fight.
The 2018 legislation was aimed at triggering a challenge to Roe v. Wade, the U.S. Supreme Court's 1973 landmark decision which established that women have a constitutional right to an abortion.
When the Iowa law was first passed, Republican state senator Rick Bertrand of Sioux City told Reuters, "We created an opportunity to take a run at Roe v. Wade - 100 percent."
The ultimate goal, abortion opponents have told multiple media outlets, is to get the case before the U.S. Supreme Court, which has become more conservative under President Donald Trump.