How to get post URL in the_content filter?

You can do a conditional and return the post’s URL by using a get_the_permalink() in conjunction with is_single():

add_filter( 'the_content', 'my_filter' );

function my_filter( $content ) {

     // Check if we're inside the main loop in a single post page.
    if ( is_single() && in_the_loop() && is_main_query() ) {
        return $content . get_the_permalink();
    }

    return $content;
}