But she and her colleagues have to struggle to raise money for her efforts, which are often seen as a distraction from the more immediate job of habitat protection. “In an ideal world, we would do both,” said Stephen Palumbi, director of the Stanford University Hopkins Marine Station. “Of course, in an ideal world, there would be no funding constraints.”

Still, both strategies may ultimately be necessary. “Protecting fish communities, making sure water quality is good, all of those efforts can buy decades of time,” said Nancy Knowlton, a prominent coral-reef biologist at the Smithsonian. “But if we continue on this greenhouse-gas emissions trajectory, the only place we’re going to be able to find many corals will be in Mary’s freezers.”

Since 1949, when the British biologist Christopher Polge successfully froze and thawed a vial of rooster sperm, scientists have deployed the technique in dozens of species, including humans, pigs, oysters and bumblebees. Yet every species is different in its sperm’s response to freezing, and mastering so-called cryopreservation for a single species can take years of experiments.

Eggs and embryos, because of their much larger size, are even more difficult to preserve. “Sometimes the next step is getting punched repeatedly in the face,” said Kenneth Storey, a cryopreservation researcher at Carleton University in Ottawa. “This is hard work, hard empirical work. It’s uphill.”

In her work in Hawaii and elsewhere, Dr. Hagedorn has encountered not just those frustrations but also the quirky, mysterious nature of corals. Simultaneously animal, vegetable and mineral, corals are colonies of simple creatures called polyps, housed in the distinctive calcium-carbonate sculptures that form coral reefs.

Coral sex is poorly understood: The periodic broadcast spawns of coral sperm and eggs were essentially unknown to scientists until the early 1980s, when a team of Australian researchers on a nighttime dive began to encounter upside-down blizzards of spawn. Researchers are still unsure why so many spawns are tied to phases of the moon.

Like the Fungia on the campus of the Hawaii Institute of Marine Biology, corals sometimes stray from their expected spawning schedules, and Dr. Hagedorn has spent anxious evenings on shore in Puerto Rico and Belize, waiting for endangered corals to begin their yearly spawn in the open water.