My guess is when the horse was laying down. Goats love to get up on anything and everything, and I've often seen them get up on, and lay down on, horses that are already laying down. Since they have such good balance, some are able to stay "righted" on the horse as it rises.
Having once raised goats (NEVER AGAIN) they will jump or climb to the highest point of elevation they can reach. And if that is a horse or your new car, those little hooves do some damage.
Goats, like mules, are very intelligent animals. You just have to get their attention with a length of 3" x 2" hardwood. I too raised goats for a while *LOL*.