because pregnant people are at risk of gestational diabetes, which can be fatal to the child if undetected. If for example, there is sugar in a wee test, or if the mother is obese you get tested
I was also tested but didn't have it after sugar showed up in urine. My daughter was 8lb but I think that's because of the number of cheese baguettes I ate!