Gastric biopsy is a procedure that allows a doctor to investigate the presence of an infection or stomach cancer by taking samples of stomach tissue.