Step 1: Understand the electrolysis process.
Electrolysis is the process of using electricity to break down compounds into their components. It is commonly used for extracting metals from their ores.
Step 2: Analyze each option.
- Sodium (Na) and Magnesium (Mg) are both extracted using electrolysis.
- Aluminum (Al) is also extracted by electrolysis in the Bayer process.
- Iron (Fe) is typically extracted by reduction using carbon, not by electrolysis.
Step 3: Apply to the options.
Iron (Fe) is the metal that is not obtained by electrolysis, making option (D) correct.
Final Answer:
\[
\boxed{\text{Fe}}
\]