Habeas corpus is a petition to have a judge review the legality of the prisoner's imprisonment. Originally part of the English system of civil liberties developed during the 17th and 18th centuries, habeas corpus limited the power of kings to arbitrarily imprison people.

Today, in certain democratic countries, including the United States, the codes of criminal procedure require that an arrested person be informed with reasonable promptness of the charges and be allowed to seek legal counsel. In many other countries, persons are subjected at times to lengthy periods of imprisonment without being informed of the charges. Habeas corpus protects the arrested person from wrongdoing in the part of the court. 

In simpler terms, habeas corpus is a prisoner's legal right to seek release for unconstitutional imprisonment. For example, prison conditions could be so bad as to be "cruel or unusual punishment." Or perhaps the prisoner was illegally denied a lawyer or jailed through improper procedure. 

As to be expected, thousands of prisoners flood the legal system with petitions every month. Many prisoners do the legal work themselves, often submitting multiple petitions to state and federal courts. Very few self-represented petitions succeed; the chances are much better for a prisoner who uses a lawyer to file a petition, but even then habeas corpus petitions are very rare. 

One of the most hotly contested battles in Congress in recent years has been over limiting the right to file habeas corpus petitions. The flood of petitions has been deemed frivolous by many critics, but proponents argue that habeas corpus is one of the guarantees written into the Constitution. In the past, prisoner petitions have served to bring fundamental injustices to the attention of the courts. 

Sources: Encarta, CourtTV