Researchers at Harvard Medical School said yesterday that they have discovered how high-absorbency tampons such as Rely may have caused toxic shock syndrome.

All such tampons have been taken off the market, but the researchers said their findings suggest that it may be possible to bring the products back in a new form that lowers the risk.

Toxic shock, which has proven fatal in about 4 percent of more than 2,500 cases, flared into prominence in 1980 and, although cases were reported in men and children, most cases were linked to the growing use among women of new types of long-wearing tampons. Doctors speculated that the tampons somehow encouraged the growth of the bacterial strain that produced the toxin that brought on the disease. But they could never say exactly why or how.

This is the question the Harvard scientists believe they have answered.

The high-absorbency tampons, they have found, were made of two kinds of fiber -- polyester foam and polyacrylate rayon -- that have an unusual ability not only to absorb fluids but also to extract magnesium atoms from the vagina and bind them permanently into the fiber.

In a low-magnesium environment, they also found, certain bacteria normally present in the vagina and on skin start producing large amounts of toxin. When magnesium levels are normal, the bacteria, staphylococcus aureus, produce little or no toxin and cause no harm.

The Harvard experiments were done in test tubes. But Edward H. Kass, who led the research group, said the findings suggest that when women used tampons made with either of the two fibers, the fibers removed magnesium from vaginal fluids, prompting the bacteria to make toxin.

Fibers used to make conventional tampons currently on the market were unable to bind magnesium, the researchers found.

Kass said the low magnesium levels did not encourage the bacteria to multiply and, in fact, slowed their reproductive rate as it speeded up their toxin production.

The reason only a relatively few users of such tampons got sick, Kass said, is that most people are immune to the toxin. It is estimated that by the age of 20 about 95 percent of the population has already been exposed to "staph" toxin and has developed antibodies that destroy the toxin molecules as they enter the bloodstream.

Kass, whose research was funded by Tambrands, which makes the Tampax brand of tampons, said the findings could lead to a safe form of high-absorbency tampon. "By adding back magnesium to these fibers," he said, "we could render the fiber unable to take magnesium from the environment and prevent manufacture of the toxin."

In theory, a fiber that was treated with magnesium would take up all the magnesium it could hold and be unable to absorb any more from the vagina. It remains to be proven, however, that such a tampon would not cause other problems.

The Harvard findings are being published in the June issue of the Journal of Infectious Diseases.

Although Rely, made with polyester foam, went off the market three years ago, two other brands of super-absorbent tampons remained for sale -- Tampax Super-Plus and Playtex, both made with polyacrylate rayon. When the Harvard group found that this form of rayon also binds magnesium, Kass notified the manufacturers and, this spring, both were taken off the market.

Since toxic shock syndrome was first recognized in 1980, the national Centers for Disease Control had counted 2,683 cases by the end of 1984. Of these, 114 were fatal.

Although the number of reported cases dropped suddenly when Rely was taken off the market, some specialists say the true incidence did not decline. The reason, according to one survey of doctors, is that they are most likely to make the diagnosis and report the case if the patient is a tampon-using woman. The publicity about the tampon link, the study suggests, has turned tampon use into a diagnostic symptom.

In Minnesota, where the public health department actively seeks case reports, toxic shock syndrome continues to be as prevalent as ever.

Kass conceded that his findings do not explain the continuing incidence of the disease in women who use conventional tampons or in the one-quarter of reported cases that involve men, children and non-tampon-using women.

Doctors suspect that these cases are caused by the same bacterial toxin and that its production is triggered when flesh wounds drive bacteria under the skin where they can multiply. Kass speculated that because some surgical dressings are made with the same high-absorbency fibers once used in the special tampons, their use could trigger toxin production.