When we are loading data from an external legacy application, most of the time we have master-detail (parent-child) relationships where, after we load the parent data, we get parent IDs and then use this parent ID to load the child data. Now, imagine that we have a Salesforce instance called system A; it has accounts and contacts data, and we need to load all the data into another Salesforce instance called system B. To link the contacts to the account, we need an account ID stamped on the Contact Account field. We can get an account ID only when we load accounts. An external ID helps here to load this data into system B. We can directly use the parent's external ID to map all child records and do an upsert of the child record via the master's external ID.
There is another way in case you have no external ID (most likely if the data is not loaded from an external system and we are transferring data from one Salesforce instance to another). To do this...