GBS is often detected through a screening test. Pregnant women are usually tested for GBS between the 35th and 37th weeks of pregnancy. The test involves a simple swab of the vagina and rectum, which is then analyzed for the presence of GBS bacteria.