Immune complex deposition in the skin, kidneys, and joints, leading to extrahepatic inflammation, most frequently occurs in the context of chronic viral infections, particularly hepatitis B and hepatitis C, where the immune system produces antibodies against viral antigens, leading to immune complex formation and subsequent tissue deposition in susceptible organs like the skin, kidneys, and joints.