Someone has to invent it. Which means someone has to do experiments, try new processes, chemicals and techniques, running trials and basically work their ass off to invent this new medicine. Not to mention spend the better part of their formative years in school studying just for the opportunity to do this.
You think they're going to do that for free? If you just give all this medicine away for free, then these pharmaceutical companies (keyword: companies) would cease to exist. And once they cease to exist, new medicines would cease to be invented. And what exactly would that accomplish?
The way it works now pretty much works. Yes, some people will die. But they die to keep the pharmaceutical companies alive. And the pharmaceutical companies being alive keeps the rest of us alive. Greater good and all that.