President Abraham Lincoln himself suspended the writ of habeas corpus twice during the Civil War. Congress then passed a bill giving the president the right to suspend habeas corpus. Lincoln did so in certain cases in September of 1863 and the suspension remained in force until President Johnson lifted it near the end of 1865.
In general, Lincoln suspended the writ of habeas corpus because he felt that it was necessary to be able to hold prisoners indefinitely in order to prevent the country from falling apart. Lincoln first suspended the writ in Maryland. Maryland was wavering between secession and staying in the Union. Lincoln felt that it was absolutely necessary that the US hold on to Maryland and so he suspended the writ to allow the government to hold pro-Confederacy people. Later, Lincoln again suspended the writ when there was widespread opposition to the creation of a draft. After Congress gave Lincoln the right to suspend the writ, he suspended it permanently with regard to spies, traitors, and others.
Thus, Lincoln suspended the writ of habeas corpus because he felt that dissent could be fatal to the country in this time of emergency.