In short
A compounding pharmacy prepares customized medications for an individual patient — combining, mixing, or altering drug ingredients — to meet a specific prescription need that a commercially manufactured, FDA-approved product does not meet, such as a different dose, a removed allergen, or an alternate delivery form.
Legitimate uses include making a liquid version of a medication for a child or someone who cannot swallow pills, removing a dye or inactive ingredient a patient is allergic to, or combining multiple medications into a single preparation for convenience. Compounding pharmacies are regulated differently from standard pharmaceutical manufacturers: compounded drugs are not individually FDA-approved as finished products (since each compounded batch is technically a distinct preparation), and oversight instead relies primarily on state pharmacy boards, with federal oversight through the FDA applying more directly to larger-scale "503B" outsourcing facilities than to smaller traditional "503A" pharmacies compounding for individual prescriptions.
This regulatory structure is directly relevant to several compounds discussed in longevity medicine: peptides such as BPC-157 have been placed on FDA lists restricting their use in compounding specifically because of safety and evidence concerns, and compounded versions of drugs like semaglutide became widely available (and controversial) during periods of manufacturer supply shortages of the FDA-approved branded product, under compounding rules that generally permit this only during a documented shortage.
Because compounded medications skip individual FDA product approval, quality and potency can vary more between compounding pharmacies than between batches of an FDA-approved manufactured drug, and there have been documented instances of contamination or dosing errors in compounded products historically (including a well-known 2012 fungal meningitis outbreak traced to a compounding pharmacy). This isn't a reason to avoid compounding pharmacies altogether — they serve genuine, common clinical needs — but it is a reason to use a pharmacy with clear quality accreditation (such as PCAB accreditation) when a compounded product is part of a treatment plan.