An opportunistic infection happens more often or is more serious in people with weakened immune systems than in people with healthy immune systems. Viruses, bacteria, fungi and parasites can cause these infections. They spread in various ways, such as by air, in body fluids, or in tainted food or water.