In the common law legal system habeas corpus, Latin for "you should have the body", is a writ requiring the government to produce a prisoner before a court and justify his or her imprisonment. Its purpose is to release someone who has been arrested unlawfully. Habeas corpus has nothing to do with whether the prisoner is guilty, only with whether due process has been observed.
Habeas corpus in the U.S.
This procedure, part of English common law, was considered important enough to be specifically mentioned in the U.S. Constitution, which states that "The Privilege of the Writ of Habeas Corpus shall not be suspended, unless when in Cases of Rebellion or Invasion the public Safety may require it." Habeas corpus was suspended at the beginning of the American Civil War by President Lincoln. His action was challenged in court and overturned by Justice Taney in Ex Parte Merryman, 17 F. Cas. 144 (C.C.D. Md. 1861). Lincoln ignored Taney's order.
Suspension of Habeas Corpus during American Civil War in 1864
Habeas corpus was suspended during American Civil War by Abraham Lincoln in parts of midwestern states, including southern Indiana. He did so in response to demands by Generals to set up military courts to rein in "Copperheads", or those in the Union who supported the Confederate cause. Lambdin Milligan and four others were accused of planning to steal Union weapons and invade Union prisoner-of-war camps and were sentenced to hang by a military court in 1864. However, their execution was not set until May 1865, so they were able to argue the case after the Civil War. It was decided in the Supreme Court case Ex parte Milligan that the suspension was unconstitutional because civilian courts were still operating and the Constitution (according to the Court) only provided for suspension of Habeas Corpus if these courts are actually forced closed.