Well, you can make the distribution from your HSA regardless. But to avoid the penalties, it would have to be a qualified medical expense, which is probably what you meant.
The instructions for Form 8889 (the IRS form dealing with HSA distributions) says: "Generally, “qualified medical expenses” for HSA purposes are unreimbursed medical expenses that could otherwise be deducted on Schedule A (Form 1040). See the Instructions for Schedule A and Pub. 502, Medical and Dental Expenses." (page 1 at
https://www.irs.gov/pub/irs-pdf/i8889.pdf)
Pub 502 is here:
https://www.irs.gov/pub/irs-pdf/p502.pdf, and says in relevant part: "Medical expenses are the costs of diagnosis, cure, mitigation, treatment, or prevention of disease, and for the purpose of affecting any part or function of the body. These expenses include payments for legal medical services rendered by physicians, surgeons, dentists, and other medical practitioners. They include the costs of equipment, supplies, and diagnostic devices needed for these purposes. Medical care expenses must be primarily to alleviate or prevent a physical or mental disability or illness."