You’re right to ask, since Duolingo is a poor authority on actual usage.
However, in this case I would say it’s right. "Avoir mal à" is such a fixed expression that it sounds bizarre to combine it with the possessive. (However, as you’ve since read in the comments & chat, this is the "official", prescriptive position — that it’s overly pleonastic — and doesn’t quite match actual usage, at least before education quashes the impulse to use the possessive.)
If you were to use the possessive, you’d want to change the expression linked to it. Even changing à to dans would be an improvement in my mind (I’m in pain — Where? — My stomach, as opposed to My stomach hurts). But better would be something like "Mon estomac me fait mal," less common but still idiomatic.
It is okay. As a french native speaker it sounds a little wierd. "Il a mal à l’estomac" is definitely more natural but using "son estomac" is gramatically correct and perfectly understandable as well.
As someone explained, this very usage example is criticized as pleonastic, from a lexical standpoint in Le bon usage. Consider it is showcased in a list containing "°Un petit nain. °Reculer en arrière. °Sortir dehors. °Une ADJONCTION d’eau SUPPLÉMENTAIRE. J’ai mal à MON ventre. […]" (Le bon usage, Grevisse et Goosse, éd. Duculot, 14e, § 15). I believe these are all absolutely grammatical, it’s just you can’t have pain to someone else’s stomach so in terms of semantics it doesn’t add anything; it still parses just fine. So you have to look into cases where it adds something else, such as a different register etc. Generally, I would think the reaction described elsewhere is typical whereas the reason why it may not work for Duolingo is alluded to in another answer (set expression etc.), and it’s a difficult topic for a correct/incorrect sort of analysis.