Free tap water is a hospitality norm, not a legal right, in nearly all of the US.
Yes, in most of the US — there's no federal law and, in nearly every state, no general law requiring a restaurant to give you free tap water. It surprises a lot of people, because free water on request feels like such a basic expectation that it seems like it must be required somewhere. It mostly isn't.
A restaurant is a private business, and as a general rule it can set its own policy on what it serves and to whom, as long as it isn't discriminating based on a protected characteristic like race, religion, sex or disability. Health codes require restaurants to have access to potable water for food preparation and handwashing, but that's a sanitation rule, not a customer-service mandate — it doesn't create a right for you to be handed a glass of it.
A handful of cities and counties have their own ordinances requiring restaurants to provide free tap water on request, usually tied to reducing bottled-water waste — these are local, not statewide, so the existence of one in your city doesn't mean a restaurant in the next town over is bound by it. Florida administrative rules also specifically require that water be potable (safe to drink), even though they don't require it be free. Outside of a specific local rule like that, the default across the US is that a restaurant can decline to serve water, charge for it, or limit it to paying customers, exactly as it could decline to serve any other optional item.
If water matters for a medical reason (taking medication, a health condition), most restaurants will accommodate that request as a matter of courtesy even though it isn't a specific legal entitlement — it doesn't hurt to say so.