GBS is diagnosed through a swab test of the vagina and rectum, usually performed between weeks 35 and 37 of pregnancy. If a woman tests positive for GBS, she will receive intravenous antibiotics during labor to reduce the risk of transmitting the infection to the baby.