Pope Francis, 84, underwent a surgery Sunday for an inflamed large colon, a Vatican statement said.
The pontiff was admitted to Rome's Gemelli University Hospital "for a scheduled surgery for symptomatic diverticular stenosis of the colon," it read.
The condition causes potentially painful inflammation of the diverticulum, a pocket that can form on the colon walls and which tend to multiply with age.
A potential complication is an abnormal narrowing of the colon.
Earlier Sunday, the pope gave the weekly Angelus prayer at St Peter's Square.
There, he announced that he would visit Slovakia in September after a brief stop in Hungary to celebrate a mass in Budapest.
In the afternoon, the pontiff arrived at the clinic accompanied by his driver and one close aide, and Italian media said he was in the operating room a few hours later.
Following the operation, a statement from the Vatican said he has reacted well to the intervention.
The pontiff was expected to spend the night in hospital, according to medical sources quoted by Italian news agencies.
In recent years, the pope has had to cancel some public appearances and sometimes has difficultly walking.
Born on December 17, 1936 in Buenos Aires, Argentina, Francis lost part of his right lung at the age of 21. He also suffers from a hip problem and sciatica.
Francis' visit to Slovakia will include the cities of Bratislava, Presov, Kosice and Sastin, the Vatican said in a statement.
Although more detailed plans for the trip will be announced later, there was no indication the pope intended to meet Hungary's political leaders during his stop in Budapest.