I've long thought that people who go into public service type positions should get loans forgiven....that might mean teachers, lawyers who become public defenders, doctors who work in underserved communities. I would not give a pass to people who join the high buck end of a profession, such as lawyers in private practice, doctors who practice in wealthy communities for big bucks, etc. I think we need to do everything we can to encourage people to serve the underserved. It's very difficult to enter one of these professions which require advanced degrees (and make no mistake, most teachers now must have a masters level degree pretty quickly) and often crippling student loans, and then expect them to work in the areas with the most pressing need (which can often afford to pay the least).
In the US, for qualifying federal student loans, there is the Public Service Loan Forgiveness (PSLF) program, see https://studentaid.gov/manage-loans/forgiveness-cancellation/public-service . PSLF has loan forgiveness that is NOT taxable after 10 years of qualifying repayment.
If one's occupation doesn't qualify but the loan type does, there are other Income-Driven Repayment Plans, which have loan forgiveness (which currently IS taxable) after 20 or 25 years depending on the type of loan. See https://studentaid.gov/manage-loans/repayment/plans/income-driven
There are also some other types of loan forgiveness programs for certain specific occupations.