Protecting against pathogens such as microscopic organisms and foreign substances that arise from outside the body is the role of the immune system.
Inside your body there is an amazing protection mechanism called the immune system. It is designed to defend you against millions of bacteria, microbes, viruses, toxins and parasites that would love to invade your body. To understand the power of the immune system, all that you have to do is look at what happens to anything once it dies. That sounds gross, but it does show you something very important about your immune system.
When something dies, its immune system (along with everything else) shuts down. In a matter of hours, the body is invaded by all sorts of bacteria, microbes, parasites... None of these things are able to get in when your immune system is working, but the moment your immune system stops the door is wide open. Once you die it only takes a few weeks for these organisms to completely dismantle your body and carry it away, until all that's left is a skeleton. Obviously your immune system is doing something amazing to keep all of that dismantling from happening when you are alive.