If it’s a high dollar horse that you don’t want to lose ownership rights over then do a yearly lease for one third his value like the hunter folks do.
If you seriously want to know if a buy back contract is enforceable in your jurisdiction then consult with a local lawyer in equine or contract law.
No one can promise a lifetime home to a horse. The buyer might be killed, injured, bankrupt, or divorced in 6 months.
The horse may not be suitable.
Or the new owner may be successful with the horse and then offer him for sale for double what she paid you, and give you first refusal, but you can’t afford it.
Frankly as a buyer I would never pay money for a horse with this kind of contract attached, especially high dollar money. I would take a horse on extended free lease, but I wouldn’t pay market value on a good horse that I didn’t own.
Besides, resale to a good home is not a bad ending. Flipping a horse is not evil. Let’s say trainer buys nice young horse, puts 3 months schooling on, then sells for twice the purchase price to a junior who adores him and does very well. Later when junior goes to college she sells him to another junior and he lives out his life in their pasture, finally half leased to a middle aged returning rider. Nothing in there is remotely bad for the horse.
Ok an idealized story, but selling a horse does not mean his life gets worse. In many cases it improves.
If you are trying to vet buyers, in general trainers flip horses and ammies keep them if they are a suitable match.