The ruling followed opposition from a prosecutor from the Uganda Communications Commission, who asked the court not to release the accused.
Mr Mr Abdul-Salam Waiswa argued that granting the journalists their freedom would endanger national security.
If released, he told the court, the accused are likely to repeat the offence.
Mr Waiswa quoted the affidavit of the investigating officer Isaac Oketcho, who claimed that if the accused are set free, they would gain access to their computers, e-mails and mobile phones and frustrate investigations.
Mr Waiswa asked the court to consider the seriousness of the offence and the danger the accused could pose to Uganda, Rwanda and the entire Great Lakes region.
Freedom of the press has been declining in Uganda in recent years, according to the Washington based-rights body, Freedom House.
“Uganda declined due to increased government pressure on media outlets regarding coverage of political events, along with a growth in bribery in exchange for favourable election-related reporting,” Freedom House noted in its 2016 report.
According to the body’s country rankings, Uganda ranked 24th on the continent and at 122 in globally.