The most likely reason is that you are not signed in to Xbox Live — online play needs an active subscription.
If you are on PC, check instead that Steam is running and that your connection is not being blocked by a firewall.