Ginsburg experienced fever and chills on Monday evening and was later admitted to Johns Hopkins Hospital in Baltimore, said court spokeswoman Kathy Arberg.
At 87, Ginsburg is the oldest member of the court and a cancer survivor.
Arberg said the justice underwent an endoscopic procedure Tuesday afternoon to "clean out a bile duct stent that was placed last August."
"The justice is resting comfortably and will stay in the hospital for a few days to receive intravenous antibiotic treatment," Arberg said.
Just hours before going to the hospital, Ginsburg dissented in a late-night 5-4 decision by the court clearing the way for the execution of Daniel Lewis Lee, the first federal inmate to receive the death penalty in 17 years.
In May 2020, Ginsburg was treated for several days at the same hospital for an infection caused by a "benign gallbladder condition."
The health episode in May did not impede Ginsburg's participation in court business and she participated in telephonic oral arguments from the hospital.
ABC News confirmed this spring that Ginsburg had been continuing her famous workouts during the pandemic at a special fitness space set aside for her inside the courthouse. In January, she declared that she is "cancer free."
She was also hospitalized in November 2019 for a possible infection.
"I wish her the best. I hope she is better," Trump told reporters. "She has actually been giving me some good rulings."