They don't keep them on the shelf for very long. When you go buy a car battery its best to buy them from a store that moves a lot of them so you can be sure you have a fresh one. There are web sites which tell how to decode the date code marked on them so you can be sure it hasn;t set for too long. They are kind of like produce, if they sit for too long they start to go bad.
Note that there are deep cycle batteries which can be deeply discharged without harm but you don't normally put those in cars, those are for things like the "house" battery in an RV, you normal car battery the plates are thinner and start to deteriorate (did I spell that right, can't have firefox on the work pc) when they discharge.