While the type of serious health issue where there is surgery or ongoing therapy involved often gives time for producers to make an alternate plan. Where a random bug attacks in the middle of a run, the only solution where an actor has a raging temperature or burning throat is to perform sick or and when that is absolutely impossible either a stage manager reads or you cancel.
The last two days of Taming of The Shrew actor Scott Florence, who played Petruchio, had to push his way through and make himself heard though his throat was strained and his body was achy. One just has to dig down and get it done.
You can take all sorts of precautions, drink the right tea, eat the right foods, bathe your throat in honey and get a flu shot but there is never a guarantee that you will not get sick. I have seen some amazing demonstrations of mind over matter and sheer willpower. In a three week run a company can’t afford to pay understudies so there is a lot of luck and intestinal fortitude to make sure that there is a show at all.