The process for electing a new pope in the Catholic Church has gone through many changes over the centuries. It wasn't always as clear as it is now, and when the process took over 2 years in the 12th century, Gregory X developed the idea of a conclave.
The Catholic Encyclopedia explains how the absence of a time limit prolonged the election of a new pope for over 2 years.
Not surprisingly, subsequent popes found this delay to be unbearable, and it took Gregory X to implement some very strict protocols.
Cutting off food and water certainly seems a bit extreme to our modern ears, but Gregory X wanted to ensure that the cardinals knew the gravity of their duty and did not delay electing a new leader of the Catholic Church.
The idea of a conclave (the word comes from the Latin for "with key"), cut-off from the rest of the world, also helps limit outside influence. Previously various kings and nobles would try to influence the appointment of the pope, and this new protocol helped lessen this possibility.
Currently conclaves are conducted in a similar manner, though the extreme measures of depriving the cardinals from food and water are no longer needed.