Inertial dampers aren't that reliable
Without water, a zero-gravity environment would still have been dangerous for the whales.
In the absence of water, the whales would have needed null gravity within their chamber to keep from collapsing under their own weight. Without water to hold them in place, the whales would then have been vulnerable to buffeting. Even gentle maneuvering of the ship could drive two unsecured, multi-tonne squishy masses into the bulkheads, and the slingshot around the sun involved extreme acceleration and potentially violent maneuvering. As Star Trek has shown numerous times when bridge crews are thrown about, ships' inertial dampers can reliably cope with steady acceleration but not with sudden lurches.
Around the midpoint of the previous film, Enterprise attacks the same Klingon Bird-of-Prey. The Klingon bridge crew are jostled in their seats, and their reactions seem out of proportion to the bridge console explosions, which suggests that the entire ship is lurching:
In "Redemption, Part 1", a rebel Klingon vessel fires a torpedo at Gowron's flagship. The impact shakes Gowron (foreground, seated) and nearly knocks a standing bridge officer (background) to the deck. As the attack proceeds, the flagship continues to shake:
In The Voyage Home, Scotty undoubtedly could have cobbled together some sort of active restraint system using tractor beam emitters, but he was working with a limited supply of equipment and an unfamiliar programming interface. Water, as a passive restraint, was the safest option.