US District Judge Kathleen Williams formalised a temporary halt, citing violations of environmental laws and the state's failure to justify the facility's location or consider alternatives.
The judge expects the facility's population to decline within 60 days through transfers, after which fencing, lighting, and generators are to be removed from the site.
The state of Florida has filed a notice of appeal against the ruling, while environmental groups and the Miccosukee Tribe hailed the decision as a landmark victory for the Everglades.
The detention centre, quickly built two months ago, has faced criticism for its impact on sensitive wetlands and reports of poor conditions for detainees.