Active and passive immunity are two mechanisms by which the body defends against pathogens. Active immunity involves the immune system producing its own antibodies in response to exposure to an antigen, while passive immunity involves transferring pre-formed antibodies from another source. They differ in how immunity is acquired and duration of protection, with active immunity providing longer-term protection through memory cells and passive immunity providing immediate but temporary protection.