Why was the story written?
Sewell was a lover of all animals, particularly horses. Along with an innate gentle nature and sensitivity to creatures, Sewell's awarness of cruelty to animals may have been raised by the growing presence of the SPCA in England (Society for the Prevention of Cruelty to Animals). The original purpose of the SPCA was to prevent cruelty to horses. England had the first ever SPCA. It was founded in England in 1824, when Sewell was four years old. By the time the author was in her late teens and twenties, the SPCA's efforts were were well known.
As the biography here at eNotes mentions, even in death Anna Sewell continued her advocacy of animal rights. When she died, her mother saw to it that the horses who pulled her coffin did not have reigns, something Anna was against.
In my opinion, the primary reason for writing the story was to expose the inhumane treatment of horses by human beings. The book serves as a catalog of abuse of animals from maliciousness to carelessness. Pretty much every chapter shows the reader a different way that people were abusing horses in those days.
I think the author loved horses and wanted to show what great creates they are, and also to decry the way they were treated in England at that time.