they kinda gradually stop drinking over 2-3 days, often on the day of the shoot they don't drink anything, it makes your skin kinda thinner and it helps make your muscles more "ripped"
A healthy, normal-weight adult can fast safely for a week, after that you should get a doctor involved to take blood levels to be on the safe side and take whatever micro-nutrients you get prescribed. The longest fast ever was done by Angus Barbieri, 382 days, on a diet of coffee, tea, sparkling water and supplements (as per doctor's order). He was an absolute unit going in normal weight people don't last that long.
Going without water will be deadly in three days or less, no exceptions. Doing it in a climate where you're not sweating helps but ultimately you have metabolic products to flush out of your system which won't work without water intake. The body is going to allow poisoning itself before it shuts down, that's the kind of situation where no matter what you intend to do, at some point you're going to catch a rabbit with your bare hands, rip of its head, and drink the blood.
Oh, and while I'm at it: Distilled water is safe to drink. Yes, it's easier to get water poisoning with distilled water as opposed to ordinary but either is an achievement and requires fasting as well at not giving in to that sudden urge to murder your salt shaker. We get the overwhelming majority of our minerals from food, not drinks.
Mostly testosterone for building the muscle base probably, then potentially something like anavar (oral oxandrolone) for a few weeks before filming the shirtless scenes, as orals make you temporarily blow up with water and glycogen. Could be some use of diuretics before filming, too - they definitely use water manipulation/restriction to get that ultra-lean look on the day. I've only included drugs you could feasibly get from the doctor, rather than anything too exotic. I do, however, guarantee they all used a significant amount of steroids in addition to the extremely strict diet and training they are very keen to talk about.