Sure, submarines get rusty.
Just like any other steel-hulled ship, a submarine will rust.
There are lots of ways of preventing rust, and the more money you have
to build a high-quality submarine or other boat, the more you can do to
prolong its life.
Actually, I must mention that not all submarines are made of
steel. Small pleasure craft not designed to go very deep may be made of
fiberglass -- these offer a fun alternative to scuba diving for viewing
fish but aren't good for much else. The steel parts on them may get
rusty, but not the fiberglass.
You can paint a submarine to help prevent rust -- keep the water
away from the steel and you can slow down or stop the rust. You can
make the submarine out of alloys that don't rust as easily. There are
strength and cost tradeoffs involved. You might want to make a
submarine out of stainless steel if it were cheap enough and strong
enough (it might be strong enough, I don't know), but stainless steel
is really expensive.
We've already answered questions about attaching magnesium bars to
the hull, in electrical contact. The magnesium oxidizes instead of the
hull (it's not perfect but helps slow down the rusting process).
(republished on 07/13/06)