Adults still think that somehow it's common for people who are overweight not to realize they are overweight or not know that being fit is a viable option for them. It is a poorly-informed and short-sighted idea that by making a point to an overweight person that they need to lose weight you'll charge them up with enthusiasm and ability to lose weight in a healthy way. From adjusting their lifestyle to treating a health condition (because weight gain can be a result of certain medical conditions, or a side effect of taking medication), for someone to start successfully losing fat in a healthy way so they can become fitter and hopefully happier, offhanded negative comments are unlikely to do the job. Open body shaming is of course just cruel, and studies are conclusive on fat shaming making people put on more weight, beyond lowering their self-esteem, of course.
You have to consider that there are various root causes of why someone suddenly became overweight, or why someone has been overweight ever since you met them. As a friend, much less a stranger on the Interner, the chances that you will fully understand what the root cause is for the person are low. Research shows that genetic predisposition for obesity may be as high as 70-80%, and then there are trigger factors like diet, exercise, social environment that starting from a person's childhood, when they can hardly control any of those, affect their body composition in a significant way.
From your perspective it might seem you're helping when telling an overweight person they should lose weight to be healthier, but it might turn out that this person has been secretely struggling with an ED or yo-yo dieting and you just triggered them to spiral worse. Or maybe a person indeed doesn't have enough self-discipline or willpower in the moment to make significant changes in their life that will help them lose weight. You think your comment is going to magically give it to them instead of just pushing on their likely insecurity?
It's a complex issue, a serious struggle for many people, and it's long overdue that people learn not to be treating it as something simple, much less something to mock or be dismissive about.