The immune system develops through a series of stages, beginning in the fetus. Hematopoietic stem cells in the bone marrow differentiate into various types of immune cells, including T cells, B cells, and natural killer cells. These cells undergo further maturation and specialization in primary lymphoid organs, such as the thymus and bone marrow, before migrating to secondary lymphoid organs like the spleen and lymph nodes.