Paste the following in functions.php:

$return = str_replace('target="_blank" href=', ' target="_blank" href=', $text);
$return = str_replace(' target="_blank" href="http://domain.com', 'target="_blank" href="http://domain.com', $return);
$return = str_replace(' href="#', 'href="#', $return);
$return = str_replace(' target = "_blank">', '>', $return);
return $return;
}
add_filter('the_content', 'autoblank');
add_filter('comment_text', 'autoblank');

Replace domain.com with the actual domain of your site.

Source: https://wjekoslaw.wordpress.com/2013/07/03/making-all-external-links-open-in-a-new-tab-in-wordpress/