Opportunistic infections occur when pathogens take advantage of weakened immune systems, often seen in individuals with conditions like HIV/AIDS or those undergoing immunosuppressive treatments. These infections can be caused by bacteria, viruses, fungi, or parasites that are typically harmless in healthy individuals but can lead to severe health complications when the immune system is compromised.