You will use домой with verbs of motion. These verbs describe destination and mode of transportation. You will use дома for location.
Essentially, дома answers the question "Где?" (Where?) and домой answers the question "Куда?" (compare to the old english "Whither?").
We are using a verb of motion here (идти) and because verbs of motion do not answer location we can't use дома. However, they do answer destination, thus we use домой.
(Recovered comments) 1: Hello, friend!
The last "и" of "лошади" is just mixed with the first "и" of "идут" here. I hear this difference, you don't. I think, it is because our mind draws a consistent picture of the world for us. I just know that "лошадь"(singular) can "идут" (plural) never in my native language. Maybe my ear also doesn't hear the different "и", but my picture whispers to me: there only might be two "и", not one, only two here , and it seems to me that I actually hear two "и". Try to catch it, this double "и" sounds little longer that normal one. But how I'm already said, probably your mind and your picture have to work without you. And this is just a mater of your experience.
You can conduct a very interesting experiment. Ask any Russian to say not "лошади идут" and "лошадь идут". Of course, it is incorrect. Then ask another Russian to say what he heard. IMHO, that person will say, that he hears "лошади", and the double "и")))
2 AndroidKanada: ))) I'll try this experiment on my teachers.
You're right. I'm starting to notice (and do) some things unconsciously, but I still have to pay attention to catch things like идёт and идут.
1: идут - д is a hard consonant [и-д-у-т]
идёт - д' is a soft consonant [и-д'-о-т]
2 AndroidKanada: Aha - that also helps. Listening to @Shady_arc say both words on Forvo, I can hear the difference in the «д».