Domestic cows can live to 20 years; however, those raised for dairy rarely live that long, as the average cow is removed from the dairy herd around age six and marketed for beef. The life of the cow is going to depend on the purpose that they are raised for. Some cows are killed while they are still young for their meat, as it is more tender than it would be if they were older. Some cows are raised simply to give milk, so as long as they are producing properly, they will remain in the barn.
Surprisingly, there is a small number of cows who are raised almost like a pet. They are not required to do anything but eat and roam. These are mainly raised by young children and are treated as a family pet.