german patent law means in general that a license needed if the drug is only offered or put into circulation, the price doesn't enter this consideration §9 PatG:
[...] In the absence of the consent of the proprietor of the patent, any third party shall be prohibited from
producing, offering, putting on the market or using a product which is the subject-matter of the patent, or from either importing or possessing such a product for the purposes referred to;
using a process which is the subject-matter of the patent or, if the third party knows or if it is obvious from the circumstances that use of the process is prohibited in the absence of the consent of the proprietor of the patent, from offering the process for use within the territorial scope of this Act;
offering, placing on the market or using a product which is produced directly by a process which is the subject-matter of the patent, or from either importing or possessing such a product for the purposes referred to.
But there is an exception for pharmacies producing individual drug formulations in §11 PatG:
The effect of a patent shall not extend to
- the extemporaneous preparation in a pharmacy, for individual cases, of a medicine in accordance with a medical prescription or acts concerning the medicine so prepared;
So if the charity is a volunteering pharmacy that fulfils individual prescriptions, they are fine (just that it is in all probability still far more expensive than the question supposes, see below).
If the charity wants to produce the drug on a larger scale, they need a license (plus regulatory approval). There are limits to the patent owner arbitrarily denying to license because the charity may apply to a court to get a compulsory license according to § 24 PatG
(1) The non-exclusive authorisation to commercially use an invention shall be granted by the Federal Patent Court in an individual case in accordance with the following provisions (compulsory licence) where
a licence seeker has, within a reasonable period of time, unsuccessfully attempted to obtain permission from the proprietor of the patent to use the invention on reasonable commercial terms and conditions, and
the public interest calls for the grant of a compulsory licence.
(6) [...] The compulsory licence may be granted subject to limitations and made dependent on conditions. [...] The proprietor of the patent shall be entitled to remuneration from the proprietor of the compulsory licence, such remuneration being equitable in the circumstances of the case and taking into account the economic value of the compulsory licence. [...]
The equitable remuneration would include research costs, of course.
Finally, the charity could lobby with the government to void the patent according to §13:
(1) The patent shall have no effect in a case where the Federal Government orders that the invention is to be used in the interest of public welfare.
That being said, I do suspect that you seriously overestimate the possibility for a pharmacist to produce these individual drugs for low price, even if they were to volunteer their work time.
The argument would look quite different to me had you said that the charity is able to produce a drug that is sold for 100k$ for only 10k$ per dose. The Dutch university hospital's pharmacy in thieupepijn's answer who probably also have some other departments [pharmaceutical & chemistry] at hand with additional required knowledge or instrumentation if I read the news posts correctly are cited to produce a drug that commercially costs 150 - 200 k€ per patient and year for 25 k€ (presumably also per patient and year; for 2 patients).
Still, for a charity aiming to this also means that they decide against a whole lot of lower hanging fruit which are also worthy of charitable work.
Now, I'm not a pharmacist but analytical chemist. I.e., I work in the subfield that is specialized on step 4 and the proof of substance identity in the third bullet point below), but here's the insight I have:
AFAIK, individual prescriptions are typically formulated from ingredients the pharmacy buys. Thus, they'd need to buy the active ingredient - and if the ready-made drug is sold for big $$$, I don't see why the active ingredient would be sold cheaply. AFAIK, the patent typically covers the ingredient rather than the drug. (The formulated drug must pass the regulatory approval, though.)
If the pharmacy would instead set up an organic synthesis lab to synthesize the active ingredient, they'd need to
- synthesize the ingredient. This is comparatively cheap for some drugs.
- purify it: we cannot have impurities as they can pose known or unknown dangers to the patient, in some cases even the other enantiomer cannot be in the drug. Purification is typically a whole lot of work and rather expensive. Particularly for drugs that are cheap to synthesize, this step can be orders of magnitude more expensive.
Related to this is that you also need to do a whole lot of cleaning the labware to make sure you don't get contamination*.
- make sure you have the correct modification and/or possibly particle size
- Prove that they have the correct substance (incl. modification/particle size) in the correct concentration and at the required purity (and this also involves that they prove that the instruments they use work as they are supposed to). Again, a whole lot of work, and/or specialized lab instrumentation required.
In contrast, when buying the ingredient, they must only prove identity, i.e. check that the white powder is what it says on the label. This is relatively easy and fast and thus not too expensive. Basically this checks that they did not accidentally get the wrong white powder and are otherwise allowed to trust the statement of product purity that accompanies the ingredient. (The measurements they can do for this react also to impurities, though not as sensitively as required for the quantitative testing outlined above)
I may add that whenever I've met the argument that so many expensive drugs are cheap to produce the numbers given always estimated synthesis costs on the basis that the educts (starting substances for a chemical reaction) are cheap. They may not even have considered with that that you probably want to start from purified educts in pharmaceutical synthesis - but I've never so far encountered an argument that did consider steps 2 - 4 above.
*I once visited an industrial production line for drugs (tablets). When they change the product that is produced (which for the pharmacy happens all the time as we're talking individual prescriptions), they first clean everything very thoroughly. Then a dummy substance goes through, and is also cleaned away. The dummy substance is one where traces are visible (either by itself or via fluorescence), so that every little leftover trace is easily spotted and cleaned. For the production line they told us this takes several days.