minhnhat3009, it's kind of a subtle difference, so I could dodge the issue by saying "it's just an idiom to learn." But let's look at some examples (all correct):
Funk music was popular in the 1970's.
Funk music was popular for many years.
Securing new patents was the company's highest priority in its early years.
For a 10-year period, securing patents was the company's highest priority.
What's the difference? "In" situates the action in time. When did it happen? Often, the action happened only at that time, but that doesn't have to be true. For instance, I could say "Funk music was popular in the 1970's, and it is popular again today."
"For" explains how long something lasts. So if I were to say "In a 10-year period," that would mean that X happened at some point in there. By contrast, "For a 10-year period" means that X happened for the entire 10 years.
Getting back to our original, we want to say that mosquitoes carry for the virus throughout much of its life cycle. "For" is appropriate, because we are talking about how long this lasts (for much of the virus's life cycle).