What body? And who has to have it? For what purpose? And then (it might be obvious once you've answered those questions, but please spell it out anyway) why is habeas corpus so central to the law?
It is short for habeas corpus ad subjiciendum, and refers to "the great writ" in Medieval Latin
Praecipimus tibi quod corpus A.B. in prisona nostra sub custodia tua detentum, ut dicitur, una cum die et causa captionis et detentionis suae, quocumque nomine praedictus A.B. censeatur in eadem, habeas coram nobis ... ad subjiciendum et recipiendum ea quae curia nostra de eo adtunc et ibidem ordinare contigerit in hac parte. Et hoc nullatenus omittatis periculo incumbente. Et habeas ibi hoc breve.
We command you, that the body of A.B. in Our prison under your custody detained, as it is said, together with the day and cause of his taking and detention, by whatsoever name the said A.B. may be known therein, you have at our Court ... to undergo and to receive that which our Court shall then and there consider and order in that behalf. Hereof in no way fail, at your peril. And have you then there this writ.
What you do with it is determine if a person is being legally detained, so the person holding the person must bring them to the court. So it is the body of the prisoner, the jailer does have it and the court must have it. However, it's not just producing a body, it refers to the requirement to explain the legal basis for the imprisonment.
The purpose of the writ is to assure that individuals are not imprisoned illegally. Otherwise, people could be randomly swept up off the streets and directly imprisoned, with no legal recourse. This is a fundamental right recognized since the Magna Carta:
No Freeman shall be taken or imprisoned, or be disseized of his Freehold, or Liberties, or free Customs, or be outlawed, or exiled, or any other wise destroyed; nor will We not pass upon him, nor condemn him, but by lawful judgment of his Peers, or by the Law of the land
A habeas corpus action is a type of civil lawsuit brought to have a court determine who, if anyone, should have control over a human being ("the body"), which must be delivered to the court (the person who has to have it) upon issuance of a court order to that effect. A court order in such an action is called a "writ" which is a court order directed to a law enforcement officer to carry out a court's instructions.
The primary purpose of a civil action seeking a writ of habeas corpus is to collaterally attack the validity of someone's incarceration in a jail or prison.
This is usually done when the legal soundness of a criminal conviction is in doubt for some reason. But, it can also be brought, for example, in cases when someone is incarcerated in a jail or prison despite (1) not having been charged with a crime, (2) not having their detention authorized by a court within the legally permitted time period prior to a conviction, (3) not having been convicted of a crime following a criminal trial, or (4) not being released upon the expiration of a criminal sentence imposed pursuant to a conviction. For example, the writ of habeas corpus has been sought to seek the release of people held as "enemy combatants" rather than pursuant to a criminal conviction.
Until the 1890s, there were no direct appeals of criminal convictions and the only way that you could appeal a criminal conviction was via a civil action seeking a writ of habeas corpus. Some states had direct appeals of criminal convictions earlier than this but the writ of habeas corpus does precede a direct appeal as a form of relief from a wrongful criminal conviction historically and was the primary means by which one could obtain relief from a criminal conviction in 1789 when the U.S. Constitution, which preserved the right to seek a writ of habeas corpus even before the Bill of Rights added most other new criminal procedure rights under the constitution, was adopted. It can only be suspended by Congress and only when the civilian courts are not functioning due to an invasion or insurrection, within the territory of the United States.
These days, since there is now a right to appeal a criminal conviction under state law or federal statute (but not the U.S. Constitution), a writ of habeas corpus is only brought when direct appeals of a conviction have been exhausted, often several years after the original conviction (which makes a writ of habeas corpus only useful for convictions involving long sentences of incarceration). Some states have replaced the historical writ of habeas corpus with a procedural motion for post-trial relief in the underlying court case.
If relief from an allegedly wrongful conviction is denied on direct appeal and also in a state court collateral attack, either by a civil action seeking a writ of habeas corpus, or by a post-trial relief motion as state practice dictates, relief may be sought (subject to restrictive federal law limitations) in a U.S. District Court (i.e. the federal trial court with jurisdiction over the place where the person is held). It typically takes six or seven years to attempt because all other options must be exhausted procedurally before a federal civil action seeking a writ of habeas corpus is authorized.
Other than a direct appeal from a state supreme court to the U.S. Supreme Court, or a direct appeal from a state supreme court of a collateral attack on a state conviction, a federal habeas corpus action is the only chance someone convicted of a crime has to show a federal government official that state officials did not comply with federal law and the U.S. Constitution in their criminal case.
While, in theory, habeas corpus petitions can be brought in any situation where someone is currently incarcerated and the conviction is believed to be wrongful, in practice, almost all successful habeas corpus petitions collaterally attack death penalty sentences, life in prison sentences, and term of years sentences for crimes that are so long that they are functionally life sentences.
The denial rate for writs of habeas corpus is very high because it is procedurally complex but there is not constitutional right to an attorney in connection with a habeas corpus petition (unlike a direct appeal in which there is a writ to counsel if the state or federal government authorizes an appeal at all). But, about a third to a half of collateral attacks of death penalty sentences with habeas corpus petitions are successful in U.S. courts.
Executions typically follow death sentences in the United States by ten years or so, because it takes about ten years to complete a full set of direct appeals all of the way to the U.S. Supreme Court, a state collateral attack with appeals of that ruling all of the way to the U.S. Supreme Court (if relief is denied) and finally a federal habeas corpus petition with appeals of that ruling all of the way to the U.S. Supreme Court. In some cases, if new facts arise or there is a substantive change in the law that has retroactive effect, there may also be multiple post-conviction attacks on a death sentence.
It is also possible, but very rare, to bring a civil action seeking a writ of habeas corpus to determine if someone held in the custody of a private person (e.g. a child in the care of an adult, or a person in a mental institution) is being held lawfully.
Habeas corpus has a symbolically central place in the law because it was the primary means by which a private individual could contest government authority over a person in a court of law where the citizen was in theory at least on an equal footing with the state.