Some apps don't need to store information outside of the app itself, and require internet connectivity only for fetching data, not sending data. These apps are often apps which contain lists of data, or have static information stored and embedded directly in the download, or provide a single function specific to the user that stores information only temporarily (for instance, a timer app).
If you need to have a user's friends appear in the app, need to send information from one user to another in the app, need to track the user's behavior across multiple devices per login, or any sort of communication in which the data on the device needs to go elsewhere, you'll need an API.
For instance, to integrate Facebook data into your app, you will need to access the Facebook API with developer credentials or your own and query information from it.
API stands for Application Programmer's Interface, which is a fancy way of saying that it's something that your mobile app can ask for data and receive structured responses from, as well as send data to their API to interact with their system. It gives a programmer a standardized way to interact with the data inside that API, like asking for a list of recent interactions, or looking up a prescription, or placing an order, etc.
To really understand the possibilities an API brings you, take a look at theApigee Console for Facebook. Read their documentation and follow the prompts to get connected, or take a look at the screenshot below of the data in action. In the screenshot, a query for "keith.r.hanson" is being made to the API, and the right hand side of the API call shows the results that Facebook returned (more information about Keith Hanson).
Whenever you use Facebook's apps on your phones, you are tapping and interacting with an app that is asking the very same API in the screenshot above for all of the information you see within that app. When you post a photo, it is being uploaded via the API endpoints provided by Facebook for doing so.
There are APIs available everywhere to integrate with. But there isn't one for your mobile app yet. So what does a modern API look like?