Named by the court as Omaima A., 36, the German-Tunisian woman was found guilty of belonging to the Islamic State (IS) group by a regional court in Hamburg.
The judges also found her in violation of her duty as a mother by taking her three small children to a war zone, and of a war weapons control act for use of a Kalashnikov rifle.
Early in 2015, the woman and her three children joined her first husband in IS-controlled areas in Syria.
(article continues below)
See also on The Local:
After his death, she married a notorious Berlin gangster rapper who had joined the ranks of the jihadist group.
The rapper Denis Cuspert, better known under his pseudonym “Deso Dogg”, had joined IS in 2014. According to media reports, he was killed during an air attack in 2018 in Syria.
The judges found the defendant to be complicit in the enslavement of a 13-year-old girl from the Yazidi minority community.
In the trial, Omaima A. said that she “made a serious mistake five years ago”, public broadcaster NDR reported, when she joined her first husband in Raqqa, then the capital of IS in Syria.
She claimed that the Yazidi girl was a “guest” in their house.
“I apologise to her for not having been able to help her,” the woman said.
But the public prosecutor's office said that she had never truly broken with the jihadist organisation.
Her lawyer argued that she had been content to maintain the home and look after her children without supporting the militant actions of her two husbands.
Two other trials are being held in Germany in connection with abuses committed against the Yazidis.
A German woman has been in the dock since April 2019 for war crimes and murder, accused of having left a five-year-old Yazidi girl dying of thirst in Iraq.
Linked to the same crime, an Iraqi man has been on trial since last April in Frankfurt for murder and genocide, reportedly unprecedented against a member of IS.
The Islamic State group committed atrocities against the Yazidis in 2014 that are being investigated by the UN to determine whether they can be qualified as genocide.