How do I programmatically enable a view mode?
Use following code to enable view mode programmatically in Drupal 7:

module_load_include('inc', 'field_ui', 'field_ui.admin');
$bundle_settings = field_bundle_settings('ENTITY TYPE', 'BUNDLE');
$bundle_settings['view_modes']['VIEW MODE']['custom_settings'] = TRUE;
field_bundle_settings('ENTITY TYPE', 'BUNDLE', $bundle_settings);


Replace ENTITY TYPE, BUNDLE, VIEW MODE with your values.