I think this question might put you in the right direction.
In case that link is broken, here’s the answer as provided by Jon Fabry in that thread.
$post_link = get_the_permalink();
if ( preg_match('/<a (.+?)>/', get_the_content(), $match) ) {
$link = array();
foreach ( wp_kses_hair($match[1], array('http')) as $attr) {
$link[$attr['name']] = $attr['value'];
}
$post_link = $link['href'];
}
This would grab EACH link provided within the content. You can add a counter or a true false condition to just snag the first one.
So the final code would be something like
$post_link = get_the_permalink();
$first = true;
if ( preg_match('/<a (.+?)>/', get_the_content(), $match) ) {
$link = array();
foreach ( wp_kses_hair($match[1], array('http')) as $attr) {
if ( $first ) {
$link[$attr['name']] = $attr['value'];
$first = false;
} else {
// ignore it
}
}
$post_link = $link['href'];
}