I know that other slave states, like Missouri and Kentucky, remained in the Union, but Maryland was different from those states in that it was one of the original 13 colonies, and had a plantation based slave economy since it's creation. I'm wondering why it didn't secede with Virginia and the rest of the Old South?
I was talking with my wife about this, and she posited that Maryland had a different history than the rest of the South, since it was set up as a colony for English Catholics, and that areas with a large Catholic population were — for whatever reason — more pro-Union, like New Orleans. However, it seems that the uniquely Catholic character of Maryland had been lost by the time of the war, and the demographic makeup of white Marylanders isn't different from that of other white Southerners (i.e. Protestant and of English of Ulster Scots heritage) so that seems implausible. I've also had the thought that perhaps elements of the state did want to secede, but the United States government was very conscious of keeping Maryland in the Union, to keep DC from being an enclave in the Confederacy.
With regards to DC, although it's long been an urban area without the land for a plantation economy, it's my understanding that nearly 1/3 of the population was enslaved, and that it was a culturally southern city well into the 20th century. Were there strong Confederate sympathies in the city? Was there ever an attempt at pro-Confederate insurrection (i.e. an uprising by the population, not an incursion from the outside) during the War? Did the government feel that the President was safe so close to the border, or were there suggestions that Lincoln and his cabinet be relocated deeper into Union territory?
As a Marylander that has sought answers to similar questions in the past, I will be taking much of what I use here from Mitchell's "Maryland Voices from the Civil War," but apologize in advance because I am on mobile and cannot provide hyperlinks easily. I will also narrow the context specifically to free people in Maryland, as I have limited background on the wars' impact on the enslaved persons of the maryland/DC area.
Union/Confederacy division between the different regions, counties, and communities in Maryland was driven mostly by economic ties, though cultural heritage and religion had some influence on the pro-north sentiments of some communities, particularly German immigrants living in Northern and Western Maryland.
Agrarian regions that been part of the old tobacco colonies of England left much of the southern and eastern shore counties leaning pro-south, as their economic model was inextricably tied to plantation slave labor. In contrast, many in counties to the North and west of baltimore had become players in the mining, manufacturing, canal transport, and railroad industries, which mostly relied on points North for their economic lifeline. Here I mention the German immigrant communities (from whom I am descended) in northern maryland, who had more cultural and social ties to their relatives in the North, more so than to the plantation-owning aristocrats in southern and eastern shore counties who championed secession.
Tense division from county to county, city to city, and even neighborhood to neighborhood made Maryland a hot seat for riots and mob violence, as it was one of the few places during the war where people (both combatants and civilians) supporting one side had regular interaction with those who supported the opposition. Maryland's geographic location as the last-stop thoroughfare for federal troops heading into the south made such close interaction possible, and arguably led to the first deaths of the war during the Baltmore riots of 1861. The events in Baltimore were also a crucial reference point in the debate over secession that went on in the MD General Assembly.
Mobs of pro-slavery supporters, deemed by some northerners as "plug-uglies," showed up to harass, heckle, and assault federal troops sent through Baltimore to defend DC and points south. Persistent mob violence and pro-south vigilantism resulted in many of the railroads, bridges, and connections to points north being sabotaged or destroyed, as a way to bog down union troop advances. Violence and mob discontent became so bad that Maryland leaders, including the mayor of Baltimore and the Governor, ordered lines of transportation severed to prevent or slow down the movement of troops into the city.
Lincoln, a few months before, had traveled himself through Baltimore en-route to DC and was no stranger to pro-south agitators. His journey was lampooned in Maryland's pro-south newspapers during the fabled "scotch cap" incident, where an angry mob of plug uglies showed up to jump, and by Allan Pinkerton's estimations assasinate, Lincoln while he switched trains near the station at Camden Yards (oh, that beautiful warehouse!). The mob was incensed to find him already gone, leading to rumors that he had given them the slip by wearing a feminine-looking scotch cap and kilt as a disguise. In all reality, Lincoln simply switched trains late that night before, but the threat of mob violence put many of his close advisors on edge. Socially divided, mustering soldiers on both sides, and in a state of civil unrest, union troops soon seized the area now known to all the post-undergrad socialites as Fed Hill, declared martial law, suspended habeas corpus, and even aimed their artillery toward supposed confederate hotbeds, namely Fort McHenry.
Begrudgingly, the governor called for a special session of the legislature, which did it's best to reconcile political calls for secession from pro-south delegates with the pragmatism of unionist merchant-elites. The idea underpinned to the debate was that if she were to secede, Maryland would be utterly defenseless against the union. The sheer mass of union troops flooding through Maryland in the opening months of the war, the resulting mob violence, and Lincoln's vows to protect the nation's capitol with continued military support convinced most delegates against the idea of secession.
FYI, only 3% of the population of Washington, DC was enslaved on the eve of the Civil War - about a quarter of the population was enslaved in 1800, falling to 12% in 1830, and decreasing even more over the next three decades. For a time, the District was an important slave mart in the trade between the Upper South and Deep South - as slaves were moved from the eroded soils of Maryland and Virginia to the Cotton Belt. But the interstate slave trade had been banned as a result of the Compromise of 1850, and free blacks by then outnumbered enslaved people - in 1850, there were 8,461 free and 4,694 enslaved African Americans in the District.
That being said, you are correct to point out that the great majority of the city's residents were of Southern background. When Abraham Lincoln was elected in 1860s, a mob ransacked the Republican Party headquarters in Washington, apparently with the complicity of the local police. And as Lincoln prepared to travel to the White House in the spring of 1861, he was deluged by a torrent of Southern hate mail, including dozens of letters that informed him of plans to assassinate him during his inauguration. Rumors of a plot by Southern clerks and bureaucrats to stage a coup d'état also swirled around the capital.
In January 1861, fearing these potential plots, a congressional inquiry was called to determine the gravity of the threat in the capital. Calling on testimony of the mayor (who supported the Southern Democrat Breckinridge in the election) and the Governor of Maryland (who refused to travel to Washington, but told the inquiry in Annapolis that the preference of radicals was for Maryland to secede rather than to invade the District).
While the inquiry was not effective in itself, it signalled the beginning of a security apparatus that would protect the President - and the Union government more generally - against potential threats of Confederate sympathizers. Lincoln referred to this as "cleaning the devil out of Washington." This included arresting and forcing the resignation of the mayor, James Berret, because of his Confederate leanings; reforming the police force so it was no longer a patronage wing of the Democratic Party (and an enforcer of the city's draconian Black Code); the development of a federal detective agency under the direction of Allan Pinkerton that ferreted out and arrested Confederate spies; and the institution of loyalty oaths that forced the resignation of Confederate bureaucrats.
At the same time, Lincoln authorized the construction of an impregnable system of defenses around the capital, especially after the military disaster of First Manassas. By the end of the war, Washington had become the most fortified city in North America, if not the entire world, with a ring of 68 enclosed forts, over 800 mounted cannon, and 20 miles of rifle trenches surrounding the city.
Collectively, these measures ensured that whatever tendencies toward sedition that existed in the District would be kept in check during the course of the war.
Source: Kenneth J. Winkle, Lincoln's Citadel: The Civil War in Washington, DC