For funds to be tax-free upon a distribution, they must be used for eligible medical expenses (as defined by the IRS). IRS Publication 502 has the full list. If HSA funds are used for something other than a qualified medical expense, they can be subject to significant IRS penalties.
Source: “Revenue Procedure 2003-57: Section 213(d).--Medical, Dental, Etc., Expenses.” Internal Revenue Service. Accessed June 19, 2020. https://www.irs.gov/pub/irs-drop/rr-03-57.pdf.