Why isoelectronic species give similar spectral lines?
You are completely forgetting the nuclear charge of isoelectronic series. Their valence shell configuration is the same but the electrons experience a different attraction in each. As you stated

$\ce{Mg^{2+}}$ and $\ce{Al^{3+}}$ give series of similar spectral lines
(this was the question of my exam i.e.NEET)

Yes the spectrum pattern is similar but not identical. Atomic spectrum and that of ionized atoms is like a fingerprint, otherwise identifying the elements in the stars will become difficult and perhaps impossible. There is certainly some overlap in atomic spectrum but not identical as your question title suggests. A quick search of Google shows that this non-sensical question is quite popular in local exams. It is wrong. Isoelectronic species will not have an identical matching spectrum. Even the wavelengths are different.
Search this title in Google Scholar to see the wavelengths of isoelectronic series, where it available free of charge. None match with neutral sodium spectrum.
Wavelengths and levels of the Na I isoelectronic sequence from K IX through Mn XV
Journal of the Optical Society of America Vol. 66, Issue 9, pp. 899-904 (1976)