I’m absolutely certain that by the time of TNG immortality is possible, but the Federation has supressed the technology for cultural reasons (“human dignity”, etc.) I can just picture a DS9 episode where Dr. Bashir discovers that a relatively simple medical treatment could make people perpetually young; only Section 31 pays him a visit and explains that it’ll never be allowed.