Use hook to get the domain configuration from language
The domain associated with each language is stored as configuration. Using the following code, $prefix will contain the prefix, and $domain the domain used.

  $config = \Drupal::configFactory()-&gt;get('language.negotiation');
  $languages = \Drupal::languageManager()-&gt;getLanguages();
  $prefixes = $config-&gt;get('url.prefixes');
  $domains = $config-&gt;get('url.domains');
  foreach ($languages as $langcode =&gt; $language) {
    $prefix = $prefixes[$langcode];
    $domain = $domains[$langcode];
  }


I wrote the code basing on NegotiationUrlForm::buildForm(), which is the form builder for the form that sets the negotiation URL for each language.