For the generation of Fab-fragments antibodies, (possibly genetically modified) which can be made in large quantities by cells or animals, are used. Antibodies as a whole are not synthesized.
The Fab fragment is obtained from antibodies using the enzyme papain, which cleaves the antibody over the disulfide bonds in the hinge region. This results in two Fab fragments (which contain the antigen binding sites) and one Fc fragment (which contains the constant region of the antibody). See the image (from here):
!enter image description here
If you want to go further into the topic, read one of the references below.
1. Preparation and separation of Fab and Fc fragments from human immunoglobulin G with papain digestion
2. Fragmentation of IgG Using Papain