The picture to the right was taken in a home that was the lowest elevation on the block and did not have a backwater valve which allowed the City sewage to back up into the home. If you look close enough you can see on the wall behind the plumber the level had actually been up to just below the electrical outlet. A complete and utter mess for this homeowner.
What can be done to help prevent this? Make sure if you are on a City sewer system that your home has a backwater valve installed on the main sewer lateral. A backwater valve prevents the City sewer from backing up into your home.
The downside is that while the backwater valve is shut, you will be unable to use the plumbing system within your home (nothing down the drain - no toilets flushed, showers, hands washed etc) otherwise your drain waste will back up into your home. The flipside is it is a temporary inconvenience which will save you thousands of dollars in clean-up - think replacement of your furnace, water heater, appliances etc. and keep all of your neighbors sewage out of your house.
See below the illustration for exactly how the backwater valve works.