The very short answer is no, in most of the Autonomous Regions there is no law that obliges bar and restaurant owners to serve their clients tap water without charge. There are laws that regulate this in the regions of Navarra, the Balearic Islands and Castilla y León, but in all others it depends on the courtesy of the owner/manager of the establishment.
Castilla y León was the first to regulate this, in 2016, with the aim to decrease the use of plastic watter bottles. The law states that consumers cannot be charged for water that is not bottled. Included in the same law is the right to make use of the facilities of hostelería establishments without payment.
On the Balearic Islands a law from earlier this year actually obliges bars and restaurants to offer free tap water alongside the regular bottled varieties anywhere where the water supplier can guarantee the quality of the tap water for human consumption. Included in the same law is the obligation for hostelería establishments to provide ´doggy bags´ for those that ask for it, except in ‘buffet libre’ restaurants.
In Navarra they´ve gone even further. Besides the above, the law prohibits the sale of bottled water in establishments of the Public Administration, apart from hospitals. And guarantees access to free tap water at public events, besides the regular sale of bottled beverages.
In many other Autonomous Regions legislation is in more or less advanced stages of preparation, but disappeared in a drawer with recent changes of government.
In Andalucía, proposed legislation met with huge resistance from the hostelería organisations, but there too, it has never made it into law before October 2018 when the legislative term ended and there appear to be no plans to take up the project again.