You can combine prayers when you are traveling. There are other cases when you can combine prayers depending on the school of thought. For example, according to the Shaafi'i school of thought you can combine prayers when it rains with conditions.
When you travel and the travel is such that you can shorten prayers, you can also combine prayers.
You can combine Zuhr and Asr at the time of Zuhr or Asr and Maghrib and Ishaa at the time of Maghrib or Ishaa.
Imagine you are on a journey and it is time for Zuhr.
You would pray two Rak'ah of Zuhr.
Then, you would follow it up with two Rak'ah of Asr.
Now, when the time for Maghrib comes, you can combine Maghrib and Ishaa.
You would pray three Rak'ah of Maghrib and follow it up with two Rak'ah of Ishaa.
The other way to combine prayers is at the time of the later prayer.
So, you would not pray Zuhr when the time of Zuhr comes. Rather, you would make the intention at the time to pray it together with Asr when the time for Asr comes.
When the time for Asr comes, you would pray two Rak'ah of Zuhr. Then, you would pray two Rak'ah of Asr.
When the time for Maghrib comes, you would not pray Maghrib. You would make the intention to pray it at the time of Ishaa with Ishaa.
Then, when the time for Ishaa comes, you would pray three Rak'ah of Maghrib followed by two Rak'h of Ishaa.
Two important things to keep in mind when you decide to do the latter and combine the prayers at the time of the second prayer:
You must make the intention during the time of the first prayer that you will combine it with the second prayer at the time of the second. So, when the time of Zuhr comes, you have to make the intention that I will combine Zuhr with Asr at the time of Asr. You have to make this intention.
Second, when you combine prayers, you have to pray the second one right after the first one without pausing a great deal between the two. You pray the first, and follow it up with the second. Do not pause and wait, and then pray the second. Follow it up.