According to
Wikipedia, it was composed in the last years of her life, during which she remained in her house as an invalid. The novel became an immediate best-seller, with Sewell dying just five months after its publication, but having lived long enough to see her only novel become a success.
With fifty million copies sold, Black Beauty is one of the best-selling books of all time.