Set group field of a contact as required
You will need to write small extension and then implement hook_civicrm_validateForm to validate group field and then throw error. Example

/**
 * Implements hook_civicrm_validateForm().
 *
 * @param string $formName
 * @param array $fields
 * @param array $files
 * @param CRM_Core_Form $form
 * @param array $errors
 */
function xxxx_civicrm_validateForm($formName, &amp;$fields, &amp;$files, &amp;$form, &amp;$errors) {
  if ('CRM_Contact_Form_Contact' == $formName) {
    if (!empty($fields['group']) &amp;&amp; !in_array(10, $fields['group'])) {
      $errors['group'] = ts('Group field contains invalid option.');
    }
  }
}


HTH

Pradeep