Yasir Hamdi, who was born in Louisiana and raised in Saudi Arabia, was detained in 2001 and held with other accused Taliban fighters at the US Navy base in Guantanamo Bay, Cuba.
He was later, in April 2002, transferred to a naval brig in South Carolina, where he has been held in solitary confinement.
"This Court will not stand by and allow (the government) to persist in the solitary detainment of Hamdi without a satisfactory explanation," Judge Robert Doumar, of the US District Court in Norfolk, Virginia, wrote in his court order.
Doumar's order came in response to a request from prosecutors to delay by seven days a court hearing that had been set for Monday. In their request, prosecutors said they needed a delay because they were very close to reaching a deal that could send Hamdi back to Saudi Arabia.
Doumar set two conditions to grant a one-week delay.
By Monday, authorities must issue a statement explaining why they have held Hamdi incommunicado for more than two years and provide his attorney with certain documents related to his case.
If the government complies, Doumar said he would delay the hearing on Hamdi's habeas corpus petition challenging his enemy combatant designation until 7 September, but that he would not delay it any further.
Hamdi has been denied normal
Otherwise, Doumar said the government will have to bring Hamdi to a hearing on Tuesday.
Hamdi was designated an enemy combatant and denied constitutional rights due to a US citizen after his capture in Afghanistan in 2001.
Challenges to the government's detention of Hamdi, who has not been charged with a crime, went all the way to the Supreme Court, which ruled in June he had to be allowed access to the US court system.
In their request for a seven-day delay, which they filed on Thursday, prosecutors said they needed more time to finalise an agreement with Hamdi's attorneys.
They argued that bringing Hamdi to court on Monday "would serve no useful purpose, given the likelihood of his imminent release and repatriation to Saudi Arabia".
Defence attorney Frank Dunham, in a court filing supporting the delay, argued that his client's detention was "inhumane" and "intolerable".
Hamdi seeks the "surest and quickest way out of that detention and for the prompt return to his family," Dunham said. The settlement being negotiated with prosecutors is the fastest way to gain Hamdi's release, he added.
The Washington Post reported that Hamdi could be asked to renounce his US citizenship as part of the deal.