Colossus Hammer can be attached to a creature that didn’t have flying to begin with. It just won’t lose flying.
If the equipped creature gains flying after Colossus Hammer became attached to it, it will keep flying.
If an ability of the equipped creature states that it has flying “as long as” a particular condition is true, that condition becoming true will not cause that creature to gain flying. For example, if the equipped creature “has flying as long as it’s attacking,” it will not gain flying, even if it attacks after Colossus Hammer becomes attached to it.
Standard: Ej legal
EDH / Commander: Legal
Pauper: Ej legal
Brawl: Ej legal
Premodern: Ej legal
93/94: Ej legal