Basically what's happening is that the horse's immune system is a little mutated, and exposure to hay, for some reason, is causing it's immune system to turn on and trigger an acute inflammatory response. If it's really the hay that's doing it. It could be an allergen in the hay.
The immune system is composed of highly variable genes, and under very strong evolutionary pressure to change from generation to generation. This means that there are often problems with immune systems, since not all genetic combinations are good combinations. In fact, most mammals recognize family based on smells that are related to the MHC-major histocompatibility complex. The more similar MHCs, the more you consider someone related. Most mammals also seem to prefer mates with MHCs that differ from their own by a moderate amount. This is likely due to selection to find a mate with a different suite of MHC genes to increase the number of immunities the offspring has, while retaining the immunities the parents likely have to pathogens present in the current environment.