All metals will oxidize when exposed to oxygen. The rate of oxidation is like any chemical reaction, it progresses more rapidly as temperature increases.
Some metals limit the amount of oxidation by forming layer of oxide product that protects the underlying metal. In the case of stainless steels the formation of the oxide layer is called passivity. If scratched, the oxide layer immediately reforms to protect the underlying metal. The chrome content of the alloy must be on the order of 11% or higher for the protective oxide layer to form.
Aluminum is another metal that responds to exposure to oxygen in a similar manner. In the case of aluminum it is said that 90% of the maximum oxide layer forms in the first 24-hours. That's why one must clean aluminum alloys just before welding. The window of opportunity is relatively short if optimum weld quality is the goal.
The oxide layer forms very quickly with stainless steels as well, but the oxide layer melts at a temperature that is much closer to that of the base metal. In contrast, the aluminum melts at a temperature much higher than the base metal. That being said, even though the stainless steel looks "clean", the oxide layer is present. The toes of the stainless weld will be somewhat rounded if the joint isn't wire brushed immediately before welding. If the joint is wire brushed immediately before welding, the toes of the weld bead will wet in much better and blend in with the base metal with a smoother transition.
The rate of oxidation increases with temperature. When the metal is molten, as in the case of welding, oxidation is immediate if the weld pool isn't protected. The means of protecting the molten weld pool can be by using a physical barrier, i.e., a slag system, or a gas. Depending on the metal the gas can be an inert gas or an active gas or a mixture of active and inert gases. The active gas doe allow a limited amount of oxidation to occur in the case of carbon steels. The limited oxidation changes the surface tension characteristics and can affect the shape of the weld reinforcement and reduce the tendency to produce undercut along the weld toe.
In the case of stainless steel, carbon steel, aluminum, and other base metals, the root of the weld can easily oxidize if it isn't protected. In the case of shielded metal arc welding, the flux covering reacts with the molten metal forming a layer of slag that provides some protection against oxidation. In the case of gas tungsten arc welding, the inert gas may not be sufficient to protect the root surface from oxidation if the only source of shielding gas is from the torch located on the face side of the joint. The gas from the torch must be supplemented by a backing gas. There are several ways to shield the root surface, one of which is to flood the piping system with shielding gas to displace oxygen from the system. The "purge" must be sufficient to displace the oxygen to reduce it to a safe level. The safe level is dependent on the base metal being welded. In the case of aluminum, the oxide layer protects the underlying molten metal because its melting temperature (of the oxide) is so much higher than that of the base metal. A lot of aluminum is welded without the use of backing gas when the rough oxide layer isn't an issue. On the other hand in the case of other metals, the oxide layer presents a problem. In the case of austenitic stainless steel, the oxide layer can reduce the corrosion resistance if the piping is used to convey liquids that are also electrolytes. Galvanic corrosion can corrode the system very quickly. If the corroded layer can be removed either mechanically or chemically, the corrosion resistance can be improved and equal to that of the unaffected base metal.
Corrosion is a chemical process. Some metals form a protective layer of oxide that inhibits further corrosion. Some metals don't, such as in the case of carbon steels. The oxide layer of plain carbon steel offers little in the way of preventing further corrosion. If the carbon steel is alloyed with sufficient chromium, the oxide layer forms a protective layer that inhibits further corrosion. However, if the oxide layer is not uniform, the corrosion potential increases because there are "chemical" differences from one area to the next. If the system is dry, corrosion isn't usually a major issue, but if the system is wet and liquid is an electrolyte, corrosion can take place rather quickly.
The oxide layer that forms limits further oxidation. Depending on the level of shielding, the extent of oxidation is somewhat limited to relatively heavily oxidized. Improving the level of shielding will reduce the oxidation observed. The level of oxidation permitted is dependent of the nature of the service and the level of corrosion resistance needed.
If you are interested in more detailed explanation, you would have to study how metal oxidize and corrode.