Al-Jazeera swiftly issued a statement calling for the release of three other staff on trial in a separate case.
The court in that trial said it would issue its verdict on June 23 against the three journalists accused of aiding the blacklisted Muslim Brotherhood of ousted president Mohamed Morsi.
Elshamy, who works for the main Arabic-language channel of the Qatar-based network, was arrested on August 14 last year when police dispersed protest camps in Cairo set up by supporters of Morsi.
"Prosecutor General Hesham Barakat ordered the release of 13 defendants... among them Abdullah Elshamy, a correspondent with Qatari channel Al-Jazeera, due to their health conditions," the official MENA news agency reported.
Elshamy's family told AFP in May that he had shed 40 kilogrammes (88 pounds) since he began the hunger strike.
"Our request to release Abdullah was accepted by the prosecutor general," the journalist's lawyer Shaaban Saeed told AFP.
"He will be out of Torah prison once we finish the release procedures tomorrow (Tuesday) morning."
Elshamy, who has yet to face trial, has been on hunger strike since January 21 to protest his detention, according to his family.
"The decision to free Elshamy reiterates what Al-Jazeera had previously said -- that Elshamy was professionally carrying out his duty as a journalist," the broadcaster said.
The military-installed authorities have been incensed by Al-Jazeera's coverage of their crackdown on Morsi supporters, in which more than 1,400 have been killed in street clashes and at least 15,000 jailed.
Earlier on Monday, an Egyptian court set June 23 as the date for its verdict in the trial of Australian Peter Greste and two other reporters working for Al-Jazeera English.
They are among 20 accused in a trial that has triggered international outrage and fears of growing media restrictions in Egypt.
Treated like terrorists
Egyptian prosecutors have demanded the maximum penalty of 15-25 years in jail for all defendants, but defence lawyers and relatives expect the accused to be acquitted.
"I expect acquittal. The hearings itself prove my brother is innocent," Mike Greste told AFP during Monday's session.
The trial began on February 20.
"On June 23, the entire world will be watching Egypt to see whether they uphold the values of press freedom," an Al-Jazeera spokesperson said.
Of those on trial, 16 are Egyptians charged with joining the Brotherhood, which was designated a "terrorist" organisation in December during the intensifying crackdown that followed the army's overthrow of Morsi in July.
Four foreigners, including Greste, are charged with "spreading false news" and collaborating with and assisting the Egyptian defendants in their crimes by providing media material, as well as editing and publishing it.
Nine of the 20 defendants are in custody, with the rest being tried in absentia.
During the hearings Greste, a Peabody Award-winning journalist, and his co-defendants have denounced the trial as "unfair and political", charging that the evidence against them had been "fabricated".
Prosecutors have presented audio recordings, photographs, maps and other material they say show the accused had links to the Brotherhood and falsely portrayed Egypt as being in a state of "civil war" since Morsi's overthrow.
Greste and Al-Jazeera English's bureau chief in Cairo, Mohamed Fadel Fahmy, an Egyptian-Canadian, have been repeatedly denied bail.
Some of their co-defendants have claimed to have been tortured in prison.
"For six months now we have been treated like terrorists with weapons," Fahmy told the court on Monday.
He and Greste were arrested in a hotel room in Cairo on December 29 after the channel's office was raided by police.
"A television channel cannot destroy a country," said Fahmy.
The authorities have previously said that the accused were operating in Egypt without any valid media accreditation.
The trial comes against the backdrop of strained ties between Egypt and Qatar since Morsi's overthrow.
Several Brotherhood leaders have fled to Doha, and some often appear on Al-Jazeera talk shows.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ