At the end of the film Gillian is concerned that the whales won't have air, but they were already in an enclosed Plexiglass compartment.
How did the whales breathe in the compartment?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
The film's official novelisation indicates that there was a sizeable air-gap at the top of the tank, more than enough for the whales to breathe on their short journey, even if that air wasn't being recycled by the ship's life-support systems (which it almost certainly was).
Fighting the instinct to breathe, Jim kicked through the deep water. He broke the surface and flung up his arm to fend off the ceiling. The sprung seals had allowed most of the air to escape. Only a hands-breadth of airspace remained between the water and the top of the cargo bay. Gasping, treading water, he tilted his head back so his nose and mouth remained in the air. He took a long, deep breath, and dove again.
This concurs nicely with the film's shooting script.
Scene 246: TOP OF CARGO BAY
[Kirk breaks the surface, his lungs screaming for air. Only a few inches remain unflooded. He gulps air, and dives one last time.]
According to this site
On average, adult humpbacks surface every 7-15 minutes to breathe but can remain submerged for up to 45 minutes.
That said, there probably wasn't a lot of air in the tank but it was for a short trip to the sun and back with the idea being that the whales would be released into San Francisco Bay upon arrival in the 23rd century.