When a pathogen invades the body, B cells recognize specific antigens on the pathogen's surface. This recognition triggers the B cells to proliferate and differentiate into plasma cells, which secrete antibodies. These antibodies bind to the antigens, marking the pathogen for destruction by other immune cells or neutralizing the pathogen directly.