Stainless steel is a family of alloys that contains iron (Fe) with an alloying metal, usually chromium or nickel. These stainless alloys are generally known for their corrosion resistance, but some are also quite "magnetic" when exposed to a magnetic field or applied magnetic force.
In order to be considered a "stainless" alloy, the metal must contain at least 10.5% chromium and more than 50% iron. Typically the alloy must be arranged in a martensitic or ferritic crystal structure.
Austenitic grades of stainless steel are usually non-magnetic, but if they are forged, machined or welded it can be magnetized. This is a consequence of the alloy's microstructure, where small regions of iron are fully magnetized, but the direction of magnetization in these domains does not match up with an external magnetic field.
Duplex alloys are a blend of austenite and ferrite, which tend to be magnetic. The combination of these two phases creates a magnetic alloy that can be used in applications where corrosion resistance is critical, such as in electrical solenoid cores.
316 stainless steel is a popular grade for welding rods and other fabricated parts, but the chemistry of this alloy can result in some magnetic properties, especially if the parts have been highly worked (e.g., welded). A non-ferrous welding rod can be used to minimize this issue. Alternatively, the part can be annealed or thermally demagnetized to restore it to its non-magnetic state.