Cavies evolved to consume grass. Their teeth and digestion work accordingly. Unlike non-grazing rodents, they have molars that keep growing during the whole lifetime. Also, their intestins – especially their enlarged ceacum – are full with cellulose-eating microbes.
In order to keep this microbiom healthy, cavies need a constant supply of fibre. The main sources of fibre are fresh grass or the dried version, hay. When the animal can't get enough, part of these beneficial microbes dies and is replaced by other microorganism.
Until the remaining flora is still capable of digesting the cellulose, the guinea pig is most likely symptom-free, however at this stage even an antibiotic treatment or a minor gastroentric problem could be fatal.

 

Cellulose is transformed into VFA (volatile fatty acids) by the microbes, and VFA is eventually used to make fat and glucose, the fuel of the cavy. Since the digestion of the cellulose happens in the lower part of the gastrointestinal tract, while the the absorption of certain elements occurs in the small intestines, guinea pigs must produce caecotroph – a soft, nutrient-dense, predigested poop –  and consume it. Ceacotrophy is essential for them, it provides vitamins, elements, living and dead bacteria (protein).

 

When cavies can consume enough fresh grass (and water), they are perfectly fine. Grass contains all their nutritional needs, even vitamin C, which they cannot produce for themselves.
Since providing them with fresh grass year-round is usually impossible, they get hay. Hay unfortunately doesn't contain any vitamin C, so it's necessary to find another way.
Everything else is considered as snack, and thus, technically not essential for guinea pigs to thrive.