(CNN) The longer astronauts spend in space, the more likely they are to have viruses like herpes, chickenpox and shingles reactivate, according to new NASA research. The reason may be the same for viral reactivation on Earth: stress.

Samples of blood, urine and saliva were collected from astronauts before, during and after short space shuttle flights and long-term International Space Station missions. Herpes viruses reactivated in more than half of the astronauts. The study published last week in the journal Frontiers in Microbiology

"To date, 47 out of 89 (53%) astronauts on short space shuttle flights, and 14 out of 23 (61%) on longer ISS missions shed herpes viruses in their saliva or urine samples," said lead study author Satish K. Mehta at Johnson Space Center. "These frequencies -- as well as the quantity -- of viral shedding are markedly higher than in samples from before or after flight, or from matched healthy controls."

Shedding is when a virus successfully reactivates.

On both short and long-term spaceflight missions, astronauts undergo exposure to zero gravity, cosmic radiation and extreme G forces during take-off and re-entry. Added to this is confinement in small spaces, social separation from family and friends and an altered sleep cycle, the researchers said.

Spaceflight creates a stressful environment for the astronauts, awakening dormant viruses.

Four of the eight human herpes viruses were detected, including oral and genital herpes, chickenpox and shingles. Because the herpes viruses take up residence in nerve and immune cells, they're never really gone, so they can "wake up."

But luckily for the astronauts, the reactivation of the viruses doesn't necessarily mean that the symptoms return.

"Only six astronauts developed any symptoms due to viral reactivation," Mehta said. "All were minor."

But the implication for infecting others when the astronauts return to Earth is very real, especially those with compromised immune systems or newborns.

Evidence of infectious chickenpox and shingles were still apparent in body fluids up to 30 days after the astronauts returned.

The researchers are also looking ahead to future space missions, which will take them on long-term trips to the moon and Mars through deep space. A round-trip mission to Mars could take up to three years.

"The magnitude, frequency and duration of viral shedding all increase with length of spaceflight," Mehta said. "The ideal countermeasure is vaccination for astronauts -- but this is so far available only against chickenpox."

The trials of other herpes virus vaccines show little promise, so the researchers are focusing on developing targeted treatment regimens for individuals suffering the consequences of viral reactivation.

"This research has tremendous clinical relevance for patients on Earth too. Already, our spaceflight-developed technologies for rapid viral detection in saliva have been employed in clinics and hospitals around the world," Mehta said.

What happens to immune systems in space

Some of the effects of prolonged spaceflight are well known , like muscle and bone loss. The astronauts combat this with increased exercise while they're on station.

In January, researchers looked at the impact of long-term spaceflight on immune system cells of astronauts. Specifically, they studied the effects of six months of spaceflight on a type of white blood cell that kills cancerous cells in the body called natural killer cells. These NK cells also prevent viruses from reactivating.

"Cancer is a big risk to astronauts during very prolonged spaceflight missions because of the exposure to radiation," Richard Simpson, senior study author and University of Arizona associate professor of nutritional sciences, said in a statement. "[NK-cells] are also very important to kill off virally infected cells. When you're in the space station, it's a very sterile environment -- you're not likely to pick up the flu or a rhinovirus or some community-type infection -- but the infections that are a problem are the viruses that are already in your body. These are mostly viruses that cause things like shingles, mononucleosis or cold sores; they stay in your body for the rest of your life, and they do reactivate when you're stressed."

During the study, the scientists studied blood samples from eight astronauts who spent time on the space station and compared them to healthy people who have not endured spaceflight. The astronaut blood samples were taken before, during and after spaceflight.

Compared to the healthy controls and how they were before flight, the astronauts' NK cell-function was impaired during and after spaceflight. On day 90 of their stay on the space station, samples of NK-cell activity against leukemia cells in cultured dishes was reduced by 50% in crew members.

The effect was even greater in astronauts who went to space for the first time, compared to those who had previously flown missions.

"I don't think there's any doubt that NK-cell function is decreasing in the spaceflight environment when analyzed in a cell culture system," Simpson said.

But what caused this to happen? Just like in the new study, the researchers in this study believe it could be stress-induced. The first-time astronauts were also younger than the spaceflight veterans, and found their first experience more stressful, which could exacerbate their cell response.

The study is not implying that astronauts are more susceptible to cancer. On that question, future studies may tell.

Get CNN Health's weekly newsletter Sign up here to get The Results Are In with Dr. Sanjay Gupta every Tuesday from the CNN Health team.

"The next question would be, how do we mitigate these effects? How do we prevent the immune system from declining during space travel?" Simpson said. "In order to do that, you have to first figure out what's causing the decline: Is it stress? Is it microgravity? Is it radiation? Is it a plethora of things? When we figure that out, we can try to find ways to directly target those factors and mitigate them."

Researchers at Johnson Space Center are working on possible countermeasures, including exercise, nutrition-based and pharmacological, to keep astronauts healthy in space. These could all boost immune response.