In a case that had provoked a storm of protests from rights groups, the justice ministry said the 28-year-old woman was released on a pardon issued by King Mohammed VI.
Rassiouni was sentenced on September 30, along with her Sudanese fiance, a gynaecologist, anaesthetist and a medical assistant, whose convictions were also overturned, an official told AFP.
The journalist made a victory sign to the waiting media as they emerged from El-Arjat prison near Rabat, but she made no statement before joining her family and friends.
The ministry said the monarch wanted to help "preserve the future of the couple, who wanted to establish a family in line with our religious and legal precepts, despite the error they made".
The amnesty was decided on the grounds of "compassion", it said.
A government source told AFP the ruling was made "without entering into the debate that is sovereign to Moroccan citizens on the evolution of their society and in which, regrettably, certain foreigners, intellectuals, media and NGOs invited themselves to take part".
The journalist at the Akhbar Al-Yaoum newspaper, which has a history of run-ins with the authorities, denounced the affair as a "political trial", saying she had been questioned by police about her family and her writing.
Youne Maskine, a director of Akhbar Al-Yaoum, took to Twitter to hail "finally a wise decision".
Raissouni was arrested on August 31 as she left a clinic in Rabat. In court, she denied having had an abortion, saying she had been treated for internal bleeding - testimony backed up by her gynaecologist.
She was sentenced under Article 490 of the Muslim-majority kingdom's legal code.
That article punishes sexual relations out of wedlock, while the law also forbids all abortions unless the mother's life is in danger.
'Obsolete' ban
In a case that sparked widespread debate on personal and media freedoms in Morocco, her gynaecologist, who spoke up in her defence, was given two years and her fiance one year in prison.
The anaesthetist was handed a one-year suspended sentence and the medical assistant eight months, also suspended.
Rights groups were quick to condemn the verdicts, which Amnesty International described as a "devastating blow for women's rights" in the country.
Ahmed Benchemsi, the regional director for Human Rights Watch, described the sentencing of Raissouni and her fiance as a "black day for freedom in Morocco".
The verdicts were "a blatant injustice, a flagrant violation of human rights, and a frontal attack on individual freedoms," he wrote on Twitter.
The prosecution insisted she had been seen by a medic and showed signs of pregnancy and of having undergone a "late voluntary abortion".
It had said her detention had "nothing to do with her profession as a journalist".
Between 600 and 800 back-shop abortions occur each day in Morocco, according to estimates by campaign groups.
In a manifesto published on September 23 by Moroccan media outlets, hundreds of women declared themselves "outlaws" by claiming to have already violated the "obsolete" laws of their country on abortion and other social norms.
In the early 1970s, in a similar text, French women calling themselves the "343 sluts" famously declared they had had an abortion when it was still illegal.
Last year, Morocco tried thousands of people for sex out of wedlock, 170 people for being gay and 73 for pregnancy terminations.
Follow us on Twitter: @The_NewArab