How to remove ‘GROUP BY’ from SQL query produced from get_posts?

You can use posts_groupby filter:

add_filter( 'posts_groupby', function( $groupby ) {

            return '';

} );

If you want to apply to remove the GROUP BY only to main query and in the frontend, you could do something like this:

add_filter( 'posts_groupby', function( $groupby ) {

    if( ! is_admin() && is_main_query() ) {

            $groupby = '';

    }

    return $groupby;

} );