Melina Boughedir, a mother of four, was sentenced last February to seven months in prison for "illegal" entry into the country, and was set to be deported back to France.
But another court ordered the re-trial of the 27-year-old French citizen under Iraq's anti-terror law.
On Sunday she was found guilty of belonging to ISIS and handed a life sentence -- which in Iraq is equivalent to 20 years.
"I am innocent," Boughedir told the judge in French.
"My husband duped me and then threatened to leave with the children" unless she followed him to Iraq, where he planned on joining ISIS, she said.
"I am opposed to the ideology of the Islamic group and condemn the actions of my husband," she added.
Her Iraqi lawyer, Nasureddin Madlul Abd, urged the court to acquit Boughedir, describing her spouse as a "jailkeeper not a husband" who had "forced" her to join him in Iraq.
Her French defence team -- William Bourdon, Martin Pradel and Vincent Brengarth -- said they were "relieved" she had been spared the death penalty, but vowed to appeal the verdict.
Boughedir, who wore a black dress and a black headscarf, arrived in the courtroom carrying her youngest daughter in her arms. Her three other children are now back in France.
Hers is the latest in a series of verdicts doled out to foreigners who flocked to join ISIS in its self-declared "caliphate" after the terrorist group seized the northern third of Iraq and swathes of Syria in 2014.
On May 22, an Iraqi court sentenced Belgian terrorist Tarik Jadaoun, also known as Abu Hamza al-Beljiki, to death by hanging -- although he pleaded not guilty to a range of terror charges.
Jadaoun had earned the moniker "the new Abaaoud", after his compatriot Abdelhamid Abaaoud, one of the organisers of November 2015 attacks in Paris.
Even before she was sentenced, Boughedir's case sparked anger from her defence team, who had accused French authorities of interfering in the case.
On Thursday, French Foreign Minister Jean-Yves Le Drian told French news channel LCI that Boughedir was a "Daesh (ISIS) terrorist who fought against Iraq" and said she should be tried on Iraqi soil.
Her French lawyers sent a letter of protest to Le Drian, seen by AFP, in which they denounced "pressure on the Iraqi judicial system" and "unacceptable interference".
During the hearing, which lasted about one hour, the judge asked Boughedir -- who was arrested in the summer of 2017 in Mosul -- to explain why and under what circumstances she had arrived in Iraq.
He then declared that "the proof that has been gathered is enough to condemn the criminal" to a life sentence.
Bourdon said Le Drian wanted his client to be tried in Iraq to "ensure that she won't be heading back home to France any time soon", as part of efforts to prevent the return of terrorists.
Boughedir's family and her defence team want her to face a court in France, Bourdon said.
After being sentenced in February to seven months in prison for "illegal" entry, she was set to be deported back to France.
But upon re-examining her file, an Iraqi court said she had "knowingly" followed her husband to Iraq to join IS.
Second Frenchwoman Sentenced
Boughedir's husband is believed to have been killed during a vast operation by US-led coalition-backed Iraqi forces to regain control of Mosul, Iraq's second city and the jihadists' former stronghold.
On Sunday she told the court that the man she had been married to for five years had disappeared one day, walking out and saying he was going out "to look for water".
Since then, she said, she had received no information about his fate or his whereabouts.
Boughedir is the second French citizen sentenced to life in prison by an Iraqi court for belonging to ISIS, after Djamila Boutoutaou, 29, in April. Boutoutaou also said she had been tricked by her husband.
Thousands of foreign fighters from across the world flocked to the black banner of the terrorists after the group seized swathes of Iraq and Syria in 2014.
Multiple offensives have since reduced their "caliphate" to a sliver of desert territory in the east of war-torn Syria.
Iraqi courts have sentenced to death more than 300 people, including dozens of foreigners, for belonging to ISIS, judicial sources have said.
Dozens of French citizens suspected of having joined ISIS ranks are believed to be in detention in Iraq and Syria, including several minors.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.