The apex version available changes with each release. So, with Winter '14 the, apex version 29 becomes available.
Unless you change it explicitly, classes retain the version that they have when they are created. So when you are looking at the other classes in production and seeing numbers less than 27, that probably was the latest version when those classes were initially developed.
Why you might be happy leaving a class on an older version of Apex
The benefit of this is that the language behaves the way that it did when the class was written and you don't need to do extensive regression testing.
Why you might want to set a class to a newer version of Apex
If you are working with a class developed against an older version of Apex, you may need to increase the version number in order to take advantage of features exposed in later versions of the API.
Why you might have API version trouble when deploying
By default new classes and triggers are created with the latest version of API. If you are working in a Sandbox this may be one version ahead of the Production org, depending on the release window. For example my sandbox is now version 29 (Winter '14) but Production is version 28 (Summer '13). In order to deploy a new class now I would need to save it with the lower version, version 28.
Also if you are deploying through ANT, Salesforce Migration Tool etc. then you need to ensure that the API version specified in your package.xml is at least as high as the the API version of what you are deploying.
How to set the API version
The api version is changed manually, either through the UI
or if you are deploying through ANT or Salesforce IDE, by amending the metadata file which is called theapexclassname-meta.xml
<?xml version="1.0" encoding="UTF-8"?>