A loose bracket, rubber hanger or connector, or one that is badly corroded, can allow a muffler to rattle when you accelerate or drive on bumpy roads, or even when the car is stationary and idling.
A loose muffler can allow excessive movement in other components as well and increase the stress on those parts, so it can become more than an annoying noise if left unattended. If the muffler is hanging lower than normal, there's also a risk that it could be broken off by hitting a bump or going over railroad tracks.
Modern exhaust systems are usually made of aluminized steel or stainless steel, but that doesn't mean they or the parts that hold the exhaust components in place last forever. Heat, debris, road salt and moisture can all cause rust in the exhaust system.
Though a muffler rattle might be fixed simply by tightening a couple of bolts or replacing a broken hanger, the corrosion might be bad enough on the muffler or neighboring parts that they will have to be replaced.
A rattle or banging noise from the exhaust system might not be an external problem. Baffles or other components inside of mufflers can come loose and cause internal rattles.
In addition, the muffler may not be the only cause or even the culprit. Brackets and bolts securing tailpipes, heat shields above catalytic converters and other components can come loose, and catalytic converters can develop internal rattles when they go bad.