Magistrate Judge Theresa Buchanan, based in the Washington suburb of Alexandria, Virginia, rejected the argument made by the three Twitter users' that the order would have a "chilling effect" on freedom of speech.
"The Twitter order does not seek to control or direct the content of petitioners' speech or association," she wrote.
Buchanan also dismissed the argument that the order violated the Fourth Amendment to the US Constitution, which protects people against "unreasonable" searches.
The Twitter users "voluntarily conveyed their IP addresses to the Twitter website, thus exposing the information to a third party administrator, and thereby relinquishing any reasonable expectation of privacy," she said.
WikiLeaks, which has strongly criticized the order, said that three Twitter users never worked for the site but that two helped make public a video that showed a 2007 US helicopter strike in Baghdad that killed several people.
The footage, which the Pentagon complained was taken out of context, appeared to show the Apache pilots mistaking a camera carried by an employee of the Reuters news agency as a rocket-propelled grenade launcher.
WikiLeaks has since angered US authorities by posting secret documents on the wars in Afghanistan and Iraq and releasing a slew of internal correspondence among US diplomats around the world.
Aden Fine of the American Civil Liberties Union, the rights advocacy group which defended the Twitter users, said they planned to appeal.
"This is not the last word," Fine said.
"This decision gives the government the ability to obtain private information about Internet communication in secret, except in extraordinary circumstances," he said.
"That's not how our judicial system works and it shouldn't have been permitted here," he said.
Fine said the Twitter users planned to take the case to a district judge. Buchanan is a magistrate, a type of legal officer who generally helps courts prepare for trials.
Besides Jonsdottir, the accounts belong to US computer researcher Jacob Appelbaum and Rop Gonggrijp, a Dutch volunteer for WikiLeaks.
Buchanan rejected calls to drop the order in light of Jonsdottir's position as a member of a foreign parliament, who enjoys protections under Icelandic law.
The order "does not seek information on parliamentary affairs in Iceland, or any of Ms. Jonsdottir's parliamentary acts. Her status as a member of parliament is merely incidental to this investigation," she wrote.
The decision came amid growing controversy over the conditions in custody of Bradley Manning, 23, the soldier suspected of releasing the data to WikiLeaks.
In a letter released Thursday, Manning said that he was treated improperly at the Quantico military base in Virginia, including being stripped at night.
The State Department's chief spokesman, Philip Crowley, was quoted as telling a forum at the Massachusetts Institute of Technology that the treatment of Manning was "ridiculous and counterproductive and stupid."
President Barack Obama told reporters he had inquired about Manning's treatment and that the Pentagon assured him it was "appropriate."