Probably won't happen. If it does, cut off the water at the meter.
and toilets overflow?
You will have a mess to clean up. Any carpet can actually be cleaned and disinfected; you might want to replace the padding. You will need a mop and a shop vac. Be sure to mop the slab with some Clorox while you have the carpet up. After you clean the carpet, you might want to leave it out in the sun for a couple of days.
I don't know, it seems more cost effective to just buy new carpet.