Multisite foreach loop returning only one result

Each pass through the foreach() loop, you’re wiping out the values that are already in your $urls array.

Try something like this:

 function rel_alternate_network(){
    global $post;
    $slugX = is_main_site() ? $post->post_name : rtrim($post->post_name, '-in-'.strtolower(do_shortcode('[country]')));
    $urls = array();
    foreach(get_sites() as $site){
        if( $site->blog_id == get_current_blog_id()) {continue;}
            switch_to_blog($site->blog_id);
            $slugY = get_post_by_slug($slugX);
            $new_url['site'] = $site->path;
            $new_url['slug'] = $slugY->post_name;
            $urls[] = $new_url; // Adds the new URL to the URLs array.
            restore_current_blog();
    }
    return $urls;
}