U.S. District Judge Henry Kennedy Jr. signed an order Friday requiring the department to produce the memos by the White House legal counsel's office by Nov. 17. He said he will review the memos in private to determine if any information can be released publicly without violating attorney-client privilege.
Kennedy issued his order in response to lawsuits by civil liberties groups in 2005 after news reports disclosed the wiretapping.
The department had argued that the memos were protected attorney-client communications.
But Kennedy said that argument was "too vague" and that he would have to look at the documents himself.
Justice Department spokesman Dean Boyd said Saturday the department is reviewing the opinion and will "respond appropriately in court."
Shortly after the Sept. 11 attacks, President Bush authorized the National Security Agency to spy on calls between people in the U.S. and suspected terrorists abroad without obtaining court warrants.
The administration said it needed to act more quickly than the court could and that the president had inherent authority under the Constitution to order warrantless domestic spying.
After the program was challenged in court, Mr. Bush last year put it under the supervision of the Foreign Intelligence Surveillance Court, established in 1978 after the domestic spying scandals of the 1970s.
"We think just as a common sense matter the legal theories for the president's wiretap programs cannot be classified and should be available to the public," said Marc Rotenberg, president of the Electronic Privacy Information Center, one of the groups seeking the memos.
"It's an important decision because up to this point the judge has relied on the government's assertion that it has done everything properly under the law and that it has disclosed everything it needs to disclose," Rotenberg said Saturday.