Maryland's "neutrality" was heavily... er, shall we say, influenced by the thousands of Union troops President Abraham Lincoln ordered to occupy the state after Virginia seceded. In 1861, the MD legislature was very close to approving articles of secession, and the state's governor was actually in favor of the move. In general, residents of urban areas like Baltimore and Annapolis supported secession, while rural residents, especially in the western part of the state, weren't so excited about it. ("Maryland, My Maryland" aside, Confederate soldiers didn't get much help from the local citizenry at Antietam in 1862.)

The secession of Maryland would have been disastrous for the Union (encircling the capital of Washington with Confederate territory), so Lincoln resolved to stop that by any means necessary. The writ of habeas corpus was suspended, pro-Confederate legislators and journalists were jailed, and Maryland was effectively put under martial law for most of the duration of the Civil War. The decree was only lifted once victory was so close for the Union that there was no danger of secession.