I have pensions in Norway and the UK. I was told that it is possible to transfer the funds between European countries. But what would happen if I leave Europe and never return?
It depends completely on the specifics of your situation, there is no general rule. I am not sure how EU law applies to this situation and it would in any case not cover the years you worked outside of the EU so you might have to deal with each country individually and the relevant bilateral agreements. You also have to make a distinction between different type of pension systems (e.g. state pension vs. employer-funded pension fund).
In general, the best case scenario is that there is (or will be) some sort of bilateral agreement between the country (or countries) in which you worked and the country in which you will retire that would allow you to transfer your rights to a state pension (e.g. if you worked 10 years in country A and 30 in country B, you are deemed to have worked 40 years in country B and can collect a full pension there). Sometimes, there is no agreement so no way to consolidate your pension rights but it's still possible to receive a pension abroad when you retire (so, in your old age, you would get a little something from country A and a little something from country B each month).
In some countries it's also possible to receive a lump sum when you leave (typically this would not cover your contributions to the basic state pension system but only to a supplementary pension, for countries that have this distinction). It would then be up to you to reinvest that money in some way to provide for your pension later on.
Worse case scenario is that there is no way for you to recover anything and you must forfeit your rights unless you are ready to go back to the country when you retire (and even then, without a full career, your pension may very well be very small or even nil).
Now for the specifics, for the UK, the Department for Work and Pensions provides a list of bilateral agreements but not many details beyond that. There is also something called the International Pension Centre but not much luck there either. I haven't been able to find anything useful for Norway. I don't know the EU rules very well but you should be able to consolidate both of these pensions together. Once you reach retirement, you should apply for a pension to the authorities of the EU country in which you worked last.
Gaël Laurans already did a good job explainig the generics, I'll add some UK specific information.
First of all, the government has a page on how to claim the State Pension when you are living abroad. Depending on when you were born you might need to have enough UK NI contribution years to be able to claim at least some pension. I couldn't find a full table of the data, but there is a pension calculator where you can check the amount you will receive (which might be £0).
In short, if you live abroad you need to contact the International Pension Centre and send them the International State Pension Claim Form. They will need to know your foreign bank account details, and will send the pension to that account. Note that if you are no longer a UK resident, depending on the country you live you might also need to pay both UK and local taxes on your pension. Also the amount of pension you receive will not increase if you are not living in the UK, the EEA, Switzerland or one of the eliglble countries.
The previous was about the State Pension. If you also are in some kind of Workplace Pension Scheme (which has become almost mandatory: as an employee you are automatically enrolled, but you can opt out), then you have to check the company where your Pension Scheme is in. They will usually be either able to pay your pension into a foreign account, give the money back in a lump sum, or forward your earnings to one of the Qualifying Recognised Overseas Pension Schemes (QROPS). You have to check the Terms and Conditions of your Scheme to know what applies to you, and what costs you might have.
If you are also enrolled in a private pensions scheme you have to check their conditions as well. Usually they'll have the same conditions as stated before.