WASHINGTON—What a year these past few weeks have been. President Biden ’s withdrawal from the 2024 campaign caps off a historically tumultuous stretch in American politics, as a series of unexpected events—from a presidential debate for the ages to a near-assassination—have shaken up the political landscape and thrust it into uncharted territory.

Until recently, the 2024 presidential election was shaping up as a snoozer of a rematch, with the same candidates who battled each other in 2020 ignoring the electorate’s pleas for change and slogging joylessly toward a November grudge match. Now the aperture has been thrown open—and an utterly unpredictable new phase has begun .

It feels like a lifetime ago, but it has actually been just over two months since Biden challenged his opponent, former President Donald Trump , to an unusually early presidential debate, aiming to jolt a stalled campaign out of its stupor. “Make my day, pal,” Biden said in the May 15 video. The gambit worked, if not at all in the way he hoped.

At the time, Democrats were frustrated that Biden’s message didn’t seem to be breaking through. Trump was spending four days a week trapped in a Manhattan courtroom, defending himself against criminal charges based on his 2016 hush-money payments to an adult-film star. On May 30, he was found guilty of 34 felonies, becoming the first-ever former president to be criminally convicted. Yet Trump’s many legal entanglements, which once seemed likely to dominate the campaign, registered as barely a blip in the polls, where he continued to narrowly lead Biden on average. Cynical voters seemed to be waving off such seemingly historic developments as just more of the scandalous noise that perpetually pursued Trump.

With the debate on June 27, the campaign suddenly came unglued. Democrats were stunned by Biden’s shakiness , incoherence and inability to make a clear argument against his rival, who looked vigorous and stable by comparison, if not particularly truthful. Publicly and privately, party insiders began discussing what had previously been taboo. As more damning accounts of Biden’s slippage behind the scenes emerged, they began to publicly wonder if it might be time for the incumbent to take one for the team by taking himself out of the running.

At the very least, Biden needed to prove his claim that the debate was merely an aberration. He could have quickly scheduled a slew of meetings, appearances and interviews to show his mettle. Instead, he largely stuck to his previous calendar, remained mostly out of public view and took days to personally call leading lawmakers to reassure them. The few televised interviews he accepted, such as a 20-minute grilling by ABC’s George Stephanopoulos more than a week after the debate, didn’t inspire confidence . His standing in polls began to worsen.

Democrats’ panic intensified when, on July 1, the Supreme Court issued a landmark ruling declaring presidents immune from many forms of criminal prosecution, throwing Trump’s conviction and lingering indictments into doubt. For months the former president had been signaling he would be more aggressive about confronting longstanding legal and political norms in a second term; now Democrats feared he could be totally unshackled and unaccountable. Many viewed the November election as existential for the nation’s future as a republic based on the rule of law.

With so much at stake, Biden’s continuing inability to press the case against Trump created a mounting crisis within his party. The president had dug in against party insiders’ private entreaties that he reconsider, casting them as “elites” who would overturn the will of the primary voters. Seeing that their private imprecations were getting no traction, lawmakers began sounding the alarm publicly. “It’s not a question about politics,” Colorado Sen. Michael Bennet said on July 9. “It’s a moral question about the future of our country.”

So focused was the nation on Biden’s plight that when the president scheduled a rare July 11 press conference at the conclusion of the summit of the North Atlantic Treaty Organization, which he was hosting in Washington, more than 20 million people watched it live on TV. And while Biden was more cogent than he had been in the debate, he slipped and referred to Vice President Kamala Harris as “Vice President Trump,” shortly after referring to Ukrainian President Volodymyr Zelensky as “President Putin.” Many Democrats were quickly coming to the inescapable conclusion that his candidacy was simply untenable—if only the notoriously proud and stubborn president could be persuaded of that fact.

Trump, meanwhile, was riding high, eagerly stoking speculation about who he might choose for his running mate as he prepared for the Republican convention. When he scheduled a Saturday night rally for July 13 in Butler, Pa., on the Ohio-Pennsylvania border, many wondered if it was a hint that he might be leaning toward Sen. JD Vance (R., Ohio). Then, at about 6:12 p.m. Eastern time, tragedy struck. A gunman with a high-powered rifle fired at the former president and nearly hit him squarely in the head, instead miraculously grazing his ear with a bullet, killing a rallygoer and severely injuring two others.

The nation’s heart stopped. The near miss brought a new sense of gravity—and grace—to the Milwaukee convention that would cement Trump’s dominance of the modern GOP. As the convention kicked off on July 15—last Monday—Trump announced that he would indeed pick Vance, anointing a new-generation leader of the MAGA movement and signaling that he would give no quarter to the Republican Party of George W. Bush , Mitt Romney and Mike Pence , none of whom were in attendance. That same day, a Florida judge dismissed Trump’s criminal indictment for his postpresidential handling of classified documents, a development that might once have seemed seismic but now registered as little more than a blip.

As a rapturous GOP feted its new ticket in Milwaukee, Biden came down with Covid-19 and retreated to his Delaware beach house to recuperate. But the pressure on him to withdraw didn’t let up; if anything, the Republicans’ display of unity and enthusiasm intensified Democrats’ panicked conviction that Biden must be forced to see the writing on the wall. After the convention concluded, the trickle of lawmakers calling on the president to withdraw became a flood. A dozen made such statements on Friday alone—a signal that the party was collectively willing to publicly humiliate Biden if he refused to budge. Like the orchestra on the deck of the Titanic, campaign and White House officials steadfastly insisted that the president’s mind was made up to continue, but the patience of even his closest allies was wearing thin. On Sunday afternoon, Biden finally publicly acknowledged what had become clear to so many: he couldn’t go on.

All this political whiplash comes against the backdrop of a nation and world in turmoil. Wars with U.S. interests at stake rage on in the Middle East in Europe, while the American public remains deeply dissatisfied with the state of the economy, the border, and the future of democracy. Even as all this was unfolding there were heat waves and hurricanes, a massive software outage, and even the discovery of the first cave on the moon.

It comes, too, on the heels of a politically tumultuous era that has defied prediction since Trump captured the 2016 GOP nomination and scored an upset against Hillary Clinton that November. His chaotic term as president, the Covid pandemic, the mass 2020 protests, Jan. 6, 2021, Capitol riot and overturning of the 50-year right to abortion have all contributed to a sense that the nation has come off its moorings and has no one to steer it to safe harbor.

The question following Biden’s withdrawal is whether this latest development will be merely the latest jerk of the roller coaster—or a welcome respite from it. In recent days, the Lincoln Democracy Institute, a partner of the anti-Trump Lincoln Project, has asked a panel of disenchanted voters in swing states how they would feel if Biden stepped aside. A prevalent sentiment among the 311 participants across Wisconsin, Arizona, Michigan and Pennsylvania, was “relieved,” followed by both “happy” and “disappointed.” With Democrats seeming to close ranks quickly behind Biden’s endorsement of Harris on Sunday, many in the party hope they can go forward with a new sense that the old stalemate has broken and a fresh option is on the table. (Republicans, for their part, insist that Harris is equally implicated in Biden’s unpopular administration, and that her short-lived 2020 campaign showed her ineptness as a campaigner.)

Twice in the last century, sitting presidents have decided not to seek re-election. Both— Harry Truman in 1952 and Lyndon Johnson in 1968—were Democrats weighed down by unpopular wars who, unlike Biden, faced challengers from within their own party, said presidential historian Timothy Naftali. Both, unlike Biden, were able to bow out on their own time and their own terms—yet in both cases, their party went on to lose in November.

Naftali believes Biden’s legacy likely hangs on the November result, and much may depend on whether he is able to hand off the nomination in an orderly way that quiets the electorate’s jangled nerves. “If they can do it without chaos, they could very well break the cycle,” he said. “Biden’s mandate in 2020 was to restore stability to the country, to shore up institutions, to restore trust in government among Americans and restore trust in the U.S. among allies. He did that, but if Donald Trump returns to the White House in 2025, all Biden did was postpone the chaos.”

Write to Molly Ball at molly.ball@wsj.com