This could be for a number of reasons. The simplest check is to make sure your internet connection is active. Then, make sure that the hosting player has their Multiplayer options enabled in the Settings menu. Additionally for each platform, multiplayer will not be available if Xbox Live services are limited or down. You can check on that status here: https://support.xbox.com/en-US/xbox-live-status
If you are on Xbox One, ensure that you have a Xbox Live Gold subscription. Multiplayer will not function as the host or guest without one.
If you play on PC, make certain you do not use Alt+Tab excessively. Using this can put the game in a suspended state that will terminate any active multiplayer session. Other solutions for multiplayer connectivity on PC have ranged from router settings to third party antivirus software (such as Avast). Please submit a ticket if you are unable to connect after reviewing your settings and account permissions.