The lifespan of a horse in the wild is about 19 years. Domestic horses usually live quite a bit longer. The average lifespan of a domestic horse is 27 to 28 years, though I have known horses who have lived into in their thirties and forties.
According to an article from 2004 in http://www.ecmagazine.net/su04htm/oldesthorsesu04.htm, the oldest horse in the United States is Copper a 51 year old mixed Morgan breed. Copper is believed to be the oldest horse in the U.S. and possibly in the world. Prior to that the oldest horse was thought to be "Old Billy", another 51 year old horse who lived in Pembrokeshire, Wales.
The website http://www.horsekinetics.com/the-worlds-oldest-pony-dead-at-56 states that the oldest pony, 'Sugarpuff', at age 56, died on May 25th, 2007. His owner was Sally Botting of West Sussex, United Kingdom.
The oldest living miniature horse on record was a dwarf miniature named Angel, according to numerous websites including the web site http://www.guidehorse.org/faq_horses.htm. Angel lived at the Horse Protection Society of North Carolina and was over 50 years old.
Many factors contribute to the longevity of a horse. Good nutrition is neccessary to enable a horse (or any living creature) to live a long healthy life. When nutrition is lacking the animal is more vulnerable to disease and slower to heal if injured. A conscietious owner will take care that their pet's physical needs are all met. In addition to nutrition, hoofs need to be kept trimmed so that infections do not occur. Living quarters need to be cleaned often of manure and moisture to prevent foot problems and to control the worm population. Protection from extreme weather is important for your horse's health as is making sure that your horses surroundings are free from objects that he/she could be injured on. A few trees in the pasture will provide shade in the summer and wind protection in colder seasons. Horsess should always have access to a protected area such as a run-in shed.
Addressing stress and behavioral problems are also important for your horse to live a long life. If a horse cribs (chews on) and injests wood from fencing or in his/her stall, the injested wood can pierce the intestines and possibly cause death. A horse that has high energy and is not excercised may become over-stressed, act out and injure himself/herself. Visits with the vet are needed to keep your horse safe from rabies, and diseases such as, West Nile Virus, Eastern Equine Encephalomyelitis, Western Equine Encephalomyelitis and more. The healthier your horse is, the more chance it has to overcome any ilness or injury that may present itself.
Though definitley not the norm, horses can live to be over fifty years old. It is our job to make sure that their years on this earth are happy and healthy ones.