The Bahraini Shiite mother, who also holds Danish nationality, had been convicted of insulting King Hamad by ripping up a picture of him, and had chosen to keep her 17-month-old son with her in jail.
Judicial authorities ordered "the suspension of the sentence" for Khawaja and another defendant identified as Irena Bogotova who had been jailed with her four-year-old son, Abdulrahman al-Sayed said in a statement.
They were released "considering their humanitarian situation and in the interests of their children," he said.
Bogotova is reportedly Russian, but no details have been given about her case.
Zainab al-Khawaja is the daughter of prominent rights activist Abdulhadi al-Khawaja, who is serving a life sentence for plotting to overthrow the Sunni regime.
The Gulf Centre for Human Rights (GCHR) has said Khawaja was jailed for three years and one month on charges including tearing up the monarch's picture and insulting a police officer.
Her sister Maryam, co-director of the GCHR, confirmed on Twitter that Khawaja "is officially out and on her way home to her (other) children".
The foreign ministry said earlier in May Khawaja would be freed with another foreigner for "humanitarian" reasons, adding that their release was the result of a follow-up into the situation of inmates with foreign citizenship held in criminal cases.
Foreign Minister Sheikh Khalid bin Ahmed Al-Khalifa said during a press briefing with visiting US Secretary of State John Kerry in April that Khawaja would go home.
Signup to our newsletter and follow us on Facebook and Twitter!
"We're certainly aware of the reports of her release." US State Department spokesman John Kirby told reporters in Washington.
"As you know, we've consistently raised her case, so we welcome the news in the reports."
Brian Dooley of the Washington-based Human Rights First said in a statement that "while it is better that" Khawaja and her son "are out of rather than in prison, this is no major breakthrough for human rights, (and) no indicator of fundamental reform".
"If the Bahraini government is interested in serious reform it will immediately organise a mass release of political prisoners," he said.
Tiny but strategic Bahrain, home base of the US Navy's Fifth Fleet, remains deeply divided after authorities crushed a month-long, Shiite-led uprising that called for reforms in March 2011.
Dozens of activists are serving lengthy jail terms, including Sheikh Ali Salman -- the leader of Bahrain's main opposition bloc Al-Wefaq.
An appeals court on Monday increased his jail term on charges of inciting violence to nine years from the original four.
In Washington, Kirby said the United States was "deeply concerned" by the extended sentence.
"We understand now that another appeal may be available in this case," he said.
"We strongly urge the government of Bahrain to abide by its international obligations to respect and protect freedom of expression, to reject these charges against Sheikh Ali Salman and to release him."