If you are leaving Canada permanently, you will likely cease to be a Canadian resident for tax purposes. Before leaving, it is often sensible to complete and file a "residency determination request" using form NR73 to confirm with the CRA that they will not consider you a Canadian resident and ensure that you will not need to pay Canadian income taxes on your worldwide income. This is not always as simple as it sounds; where you retain Canadian ties, or if you spend a substantial amount of time in Canada, you may continue to be a Canadian tax resident, particularly where you retain a Canadian residence or family members. In a close case, it is sensible to work with a Canadian Tax Lawyer to navigate this process and ensure that you get the result you are looking for.
If you are returning to Canada, you will want to be deemed a Canadian resident for tax purposes. This may have tax advantages for you as the Canadian tax rate may be lower than what you were paying previously. It is also possible that the country that you lived in will not require that you pay any tax if you are paying taxes in Canada. In doing so, you gain a considerable tax advantage.
Yes, you may need to pay tax to two governments , depending on which countries you are refering to. The vast majority of countries assess tax on the basis of residency but not citizenship, with the United States being a very important exception. If you are in fact a tax resident of two countries, it is entirely possible that you will need to pay tax to both on your worldside income, with the caveart that in many cases offsetting foreign tax credits will be available. However, many copuntries have a tax treaty with Canada that fundamentally alters how tax residency works because of the presence of tie breaker rules.