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," still rareless common but plausiblestill idiomatic.