The study of the toxicity of foreign substances called xenobiotics and their effects on the immune system.