During maturation of B cells there is recombination to join up different DNA regions to make a huge variety. Mature B cells can undergo further editing to increase the affinity of the antibody for its target. If you GOOGLE search for [B cell maturation recombination] you can find many sources of information from wikipedia to textbooks and research papers.
There are several natural genomic events that cause diversity of DNA sequences. While Most of the events are endogenous, while some are forms of genomic response to external or environmental signals. Retro-elements could constitute part of endogenous causes of such events. Once a sequences gains or loses one or more nucleotides, its form and/or function could be modified. The outcome of these and other events is increase in the number of antibodies. Biochemical mechanisms in the body could engineer modifications that translate to diversity of antibodies.