The primary function of the germinal center is to optimize the antibody response. This is achieved through processes such as somatic hypermutation and class switch recombination. These processes enhance the affinity and functionality of antibodies produced by B cells.