I would (and have) just addressed it in the moment. I do not think it is necessary to apologize separately (although we have had those moments too).
This is a great age to sit down now and talk about observations. We can look at things online, on TV, books, talk about those observations. Then we can talk about how it is not something we need to blurt out every time we have one when out and about. Believe me, you want to do this. I was trying on bathing suits when a small child with me felt the need to inform me my butt was "lumpy" very loudly, so that everyone heard. If they do it to strangers, it's just a matter of time before they find something about you to blurt out at a bad time. And they can make it sound much worse than it is. At the time this was said, I was very thin, working out 5 days a week, and no one other than a small kid would have referred to my rump as "lumpy". I was still new enough to parenting to be mortified. Today I'd likely laugh - and then talk about it later.
So the thing I focus on at 4 is reminding them we don't talk to other people about their bodies. It's a flat no. The reason is, it's a good policy for life. There is no reason to comment on other people's clothing, hair, shape, etc. It's just not something that will enrich anyone's life and it's a lesson that is good to learn sooner than later. They are free to compliment people, but that is the only thing they are supposed to say out loud. If they must say something, they are told to tell me it's a secret and whisper it to me, then I can tell them whether that is okay to say aloud or not.
To give you an idea why this is good (over a number of children these are real things I had happen when out)... "Hey lady you got a baby in your belly? It's going to come out your vagina, but don't worry, it's okay, that is why it's there. It's a baby hole" (said right after the birth of a new sibling). "Oh you have boobs! I love boobies. I bet you have a vagina too!", "If you are so old why don't you just go lay down. You look too old to be walking around." Sometimes they also but into polite conversations. While someone was asking me how I am adjusting to 2 kids, my 3 year old piped up and said "She is doing AWESOME but her hemorrhoids are still a BIG PROBLEM". (I think this is about the time I actually relocated in witness protection LOL). There is more and more and more. BUT, it will ease, and teaching helps.
It really is just like please and thank you. It takes children time to learn rules of etiquette, what you should say and what is expected in public, etc. One of the sentences I have uttered more than any other is "mind your own business" as children seem to naturally tend to minding everyone else's business as far as I have observed. I also think many parents seem to miss really teaching this as I still see far too many adults that never learned how to mind their own either.