The Star Trek movie where they save the whales is Star Trek IV: The Voyage Home (1986).
In this movie, the crew of the Enterprise travels back in time to 20th-century Earth to obtain humpback whales, which are necessary to repair a damaged alien probe that is threatening to destroy Earth.