Drupal 7 : Programmatically validate form by form ID
You can add an extra validation function using hook_form_alter. 

If all you need is to add a captcha to the contact form you could try simply using the captcha module, or the mollom module.

If you've created the form yourself using a form builder function, you can add a validation function (with all your validators) to that:

function YOURMODULE_YOURFORM_form_validate($form, &amp;$form_state) {
// Your validation code.

}