Under External access (https://admin.teams.microsoft.com/company-wide-settings/external-communications), you can configure settings to allow or block Teams and Skype for Business users' communication with users outside your organization, as shown here:
The Users can communicate with Skype for Business and Teams users setting allows your Teams users to communicate with both external Teams and Skype users. The Skype for Business users can communicate with Skype users setting allows Skype users to communicate with external Skype users.
If you add domains, you must choose to either configure the domains to be Allowed or Blocked:
It may take up to 30 minutes for the setting to take effect.