It is. As long as what they cost to the system is balanced by healthy people paying in to it too. Since most people don't spend their life in perfect health they will benefit to.Allowing people with pre-existing conditions to buy insurance is expensive. Not affordable.
It's literally how every insurance works. Those that need the system are balanced by those that don't.