post body class for current user only if they are the post author

The code isn’t working because you haven’t defined or retrieved the $current_user or $post variables from anyway. You’ve also got a ! here for some reason: !$current_user->ID, which will just break the condition.

You need to use the appropriate functions to get their values, and also use is_single() to make sure you’re viewing a single post (otherwise the post author could be missing or something unexpected).

add_filter(
    'body_class',
    function( $classes ) {
        if ( is_single() ) {
            $post = get_queried_object();
            $user = wp_get_current_user();

            if ( $user->ID == $post->post_author ) {
                $classes[] = 'post-author';
            }
        }

        return $classes;
    }
);