The court, by a vote of five to four, ruled that detainees in the US jail in southern Cuba "have the constitutional privilege of habeas corpus".
"The laws and constitution are designed to survive, and remain in force, in extraordinary times," said Justice Anthony Kennedy, writing for the court.
Bush said his administration would "study this opinion ... to determine whether or not additional legislation might be appropriate so that we can safely say, or truly say to the American people 'we're doing everything we can to protect you'."
"We'll abide by the court's decision. That doesn't mean I have to agree with it"
Al Jazeera's senior Washington correspondent, Rob Reynolds, said the ruling was a very significant milestone in this very long running battle.
Explaining that Guantanamo was chosen because it was not on American soil and therefore would be beyond the reach of the American justice system, he said the decision was a victory for the proper system of justice.
The court ruled that even if the base was officially on Cuban territory, it was in fact operating as if it were on American soil and therefore detainees had the same constitutional rights as all Americans.
The ruling is the third on Guantanamo that has gone against the Bush administration.
Detainees and their legal teams could now demand that the government reveal the evidence against them to justify their continued detention.
The government has refused to do this arguing it would be against the interests of national security.
Detainees have long protested that they had been mistreated, and rights groups have questioned the legality of the Guantanamo Bay military tribunals.
But it was not immediately clear whether the ruling would lead to prompt hearings for the detainees, some of whom have been held more than 6 years.
About 270 so-called enemy combatants remain at the prison facility.