In Denver there is a program that supplies hospitals internationally with expired drugs and equipment that would otherwise be without. It's been going on for decades and saved many lives.
A lot of cost of drugs comes from R&D, quality control etc. The chemical synthesis itself generally isn't that expensive. And expired pills would be a quite unpredictable precursor, which isn't very desirable in the pharma industry (or anywhere else for that matter). In other words, I doubt you could make much of a profit (if any) from purifying non-decomposed chemicals from pills.