So what is the legality? AFAIK, euthanasia and assisted suicide are not legal in a lot of jurisdictions. An actual Mars mission may set a precedent, for, uhm, voluntary short-term underwater scientific missions for geriatrics and hospice patience with challenging pain management situations.
For the law, intent usually matters. If you help someone who has the intention to die, then that's assisted suicide. But people can accept any level of danger they please, as long as they intent to survive the ordeal. The actions might be the same, but the intent is different.
they applied for a training program that will give them a ton of exposure.
I doubt they will leave Earth to go dying on a desert planet with no oxygen, water and Instagram after they eventually gained the "Mars space program" status at home.