The court repudiated the fundamental legal basis for the Bush administration’s strategy of housing prisoners at the United States naval base in Cuba.