To basically restate James K's answer in slightly different (maybe hopefully clearer?) terms:
This is a case of ellipsis. The full phrase without ellipsis would look like this:
"… when a male horse and a female horse see each other …"
There are two horses. Each horse is singular, and so takes a singular article. But both of these horses are the subject of the verb, so the verb is plural.
However, repeating the word "horse" like this is somewhat awkward, and also unnecessary. We can simply leave the first "horse" out of the sentence, with the reader being able to mentally fill it in based on the surrounding context:
"… when a male and a female horse see each other …"
Here there are still two horses, each of them singular, but both of them together acting as the subject of a plural verb.
Where I personally disagree with the book's author slightly is that I would not also leave out the "a" before "female".
I would not do so in speech (where "and a" is pretty much pronounced like a single word anyway), and so would also not do it in writing. The English language is full of articles, conjunctions, preprositions and other similar short words like these that take no stress when spoken and just fall in the gaps between the other words. They are so short that omitting them saves basically no time, and naturally repeated so often that repeating them is not unusual or awkward at all.
Besides that, the phrase "a male and female horse" could be alternatively parsed as referring to a single horse that is somehow both male and female at the same time. Obviously that's not the intended meaning in the given context, but just having to consider and reject that parsing is needlessly jarring. Leaving in the second article rules out this alternative parsing.
All that said, however, the author's version is still clear and understandable enough in its context. In fact, I probably would not have even noticed the missing "a" when reading it if your question hadn't focused on that particular phrase.
Ps. Your version with "male and female horses" is also correct, but less precise: it allows for (and even implicitly suggests) the possibility that there may be more than one male horse and more than one female horse involved. The author clearly intended there to be only one of each, so they chose to use two singular subjects instead.
By the way, "male and female horses" is technically also elliptic; the full phrase without ellipsis would be "male horses and female horses".
For what it's worth, "a male horse and a female" would technically also be correct; when a repeated word can be omitted, we can usually choose either one of the repetitions to leave out. However, this version sounds slightly more awkward to my ear, perhaps because adjectives in English normally come before the nouns they refer to, and so having "female" refer backwards to the word "horse" before it feels a bit awkward. It almost calls for a placeholder like "a male horse and a female one", although, at least to my ear, that's not quite necessary in this case.