WASHINGTON—Supreme Court Justice Ruth Bader Ginsburg was hospitalized Thursday after falling in her office and fracturing three ribs. The injury forced her to miss the morning’s formal investiture of the newest justice, Brett Kavanaugh, conducted before an audience that included President Trump and Senate Majority Leader Mitch McConnell (R., Ky.).

The court said Justice Ginsburg, 85 years old, fell Wednesday evening. “She went home, but after experiencing discomfort overnight, went to George Washington University Hospital early this morning,” the court said in a press release. “Tests showed that she fractured three ribs on her left side and she was admitted for observation and treatment.”

Justice Ginsburg is the court’s eldest member and the most senior of its liberal minority. President Clinton appointed her in 1993.

The second woman to serve on the high court, Justice Ginsburg has received particularly close attention in recent years as political battles over the court’s direction, including the bitter fight over Justice Kavanaugh’s confirmation, took the spotlight. The court long has had a narrow conservative majority, but the close ideological divide among the justices makes any potential vacancy the subject of intense speculation.

Although it followed an age-old ceremonial script, Thursday’s investiture couldn’t avoid implicit references to the political struggles surrounding the court. President Trump, accompanied by the first lady, sat just feet from the bench where Justice Ginsburg’s seat, between Chief Justice John Roberts and Justice Samuel Alito, remained conspicuously vacant.

In the courtroom sat Supreme Court litigator Lisa Blatt, a self-described liberal feminist whose early endorsement of Justice Kavanaugh helped soften his reputation as a hard-line conservative—at least before Christine Blasey Ford, a California psychology professor, accused the nominee of assaulting her at a teenage party in the 1980s. That provoked Justice Kavanaugh to issue a blistering denial and accuse Senate Democrats and left-wing groups of trying to smear him.

When the chief justice called for the formal motion to install Justice Kavanaugh, acting Attorney General Matthew Whitaker, starting his first full day on the job, took the lectern to recite the lines.

Supreme Court Justice Brett Kavanaugh, fourth from the right, and other justices pose Thursday along with President Trump and first lady Melania Trump prior to Justice Kavanaugh’s investiture ceremony in Washington. Missing was Justice Ruth Bader Ginsburg, who was hospitalized after a fall. Photo: fred schilling/U.S. Supreme Court/Agence France-Presse/Getty Images

“Thank you, Attorney General Whitaker, your motion is granted,” said Chief Justice Roberts. Several Republican former attorneys general, including John Ashcroft, Alberto Gonzales and Michael Mukasey, were in the audience, but there was no sign of Jeff Sessions, who resigned Wednesday at Mr. Trump’s instruction.

But Mr. Sessions managed to make a cameo; the court clerk read Justice Kavanaugh’s presidential commission, concluding with name of its signatory: “Jefferson B. Sessions III, attorney general.”

Others in the court reflected the spectrum of Washington’s cutthroat dramas, past and present. Former Whitewater prosecutor Kenneth Starr, once a mentor to Justice Kavanaugh, attended, as did Mr. Trump’s former counsel Don McGahn, who was instrumental in pushing the nominee through to his 50-48 confirmation vote last month.

Justice Anthony Kennedy, whose July retirement opened the seat for Justice Kavanaugh, his former law clerk, attended. So did the new justice’s former colleagues on the U.S. Court of Appeals for the District of Columbia Circuit—including its chief judge, Merrick Garland, whose own Supreme Court nomination, in March 2016, was ignored by Senate Republicans, who refused to grant a hearing or vote to anyone nominated by President Obama.

The Kavanaugh ceremony did deviate from tradition in one way: Citing security concerns, the court canceled the traditional walk the new justice, accompanied by the chief justice, takes from the building’s monumental bronze doors down its marble steps, to greet the public and pose for photographs.

The court didn’t specify any threats, but Justice Kavanaugh’s contentious confirmation hearings were disrupted frequently by protesters hostile to his conservative views and critical of his ties to President Trump.

Before the ceremony, the president briefly met with the justices in their private conference room, the court said.

Some liberal legal activists had urged Justice Ginsburg to retire during Mr. Obama’s presidency, so he might name a like-minded successor. She declined then, and consistently has said she would serve as long as she was up to the job, noting that her colleague, Justice John Paul Stevens, didn’t retire until he reached 90.

During the 2016 presidential campaign, Justice Ginsburg in interviews criticized then-candidate Trump, calling him a “faker.” Mr. Trump hit back with a tweet: “Justice Ginsburg of the U.S. Supreme Court has embarrassed all by making very dumb political statements about me. Her mind is shot - resign!” he wrote.

Legal commentators said Justice Ginsburg’s remarks about Mr. Trump were inappropriate, something she acknowledged by apologizing for injecting herself into a political contest.

While lacking the flamboyance of her late colleague and friend, the conservative Justice Antonin Scalia, Justice Ginsburg has become something of a progressive icon—and pop-culture figure—in recent years.

She was the subject of a documentary film, “RBG,” and actress Felicity Jones will portray her in a drama about her rise as a leading attorney for women’s rights, “On the Basis of Sex,” which is set to hit theaters on Christmas Day. She has been made into an action figure, a Halloween costume and a design motif for totebags and T-shirts.

Justice Ginsburg’s health has received close attention for years. She cracked two ribs in 2012 and has survived two bouts of cancer. The diminutive justice walks slowly and carefully when she ascends and descends the bench when the Supreme Court is in session. But she also works out regularly with a personal trainer, sessions that have been chronicled in print and on late-night television.

Her husband, the law professor and tax attorney Martin Ginsburg, died in 2010.

The justice has a couple of weeks before she would have to worry about missing a case. The court has a private conference set for Friday and may issue new decisions on Tuesday, but it isn’t scheduled to hear oral arguments again until Nov. 26.

Corrections & Amplifications

Matthew Whitaker is the acting attorney general. An earlier version of this article incorrectly gave his first name as Mark and omitted “acting” from his title. (Nov. 8, 2018)

Write to Jess Bravin at jess.bravin@wsj.com and Brent Kendall at brent.kendall@wsj.com