When attackers are declared, the game checks legality at the moment of declaration (CR 508.1). A creature with flying is a legal attacker against any player or planeswalker, and once it is successfully declared as an attacker, it is 'attacking' — that status is locked in for the combat phase.
Losing an ability after the declaration does not retroactively invalidate the attack. CR 508.1f confirms that once creatures are declared as attackers and any triggered abilities trigger, the declaration is complete. There is no continuous check that re-validates attacker legality based on current abilities (unlike, say, blocking restrictions which are checked at declaration time per CR 509.1).
The rules that would remove a creature from combat mid-step are specific: a creature is removed from combat if it leaves the battlefield, becomes removed from combat by a spell or ability, or phases out (CR 506.4). Losing flying is none of these things.
Concrete example: You attack with a 2/2 with flying. In response to nothing (or your opponent uses a triggered ability during the declare attackers step), your opponent enchants it with an aura that removes flying. The creature is already a declared attacker — it stays attacking and will continue into the declare blockers step as a normal attacking creature, just without flying.
Note that losing flying can matter for blocking purposes (e.g., a creature with 'can only be blocked by creatures with flying' loses that ability — but that is a separate question checked during declare blockers, not during declare attackers).
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.