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.
In the case when you need to do nothing to get your pension currently and it automatically goes into your bank account all the time:
Although one approach is to seek whether you can have these funds sent to your bank in your current country of residence instead, another approach is to simply keep the bank accounts and cards associated with it and either withdraw the funds in an ATM or simply use said cards to make payments online/in shops.
Now in this case you will ask me "oh wait but what happens when the card expires?!":
Some banks may allow you to specify a foreign address where you could get those cards sent to but another option would be to "forget about the cards", if you have access to internet-banking or telephone-banking you can just make payments from your bank account without having a card associated with it (for example sending it abroad to where you currently reside or a much cheaper option would be to use internet websites such as Transferwise).
Or if you have a person you trust completely (family member?) still being in those countries you can go to a notary and ask them to produce an official document (not entirely sure how to properly call it) that would grant certain rights to a specified person, e.g. withdrawing cash from a bank account or being able to have complete control of that bank account. That person could simply come to the bank with that notary produced letter and get the cash or could get new debit cards in your name and use those to get cash or simply send those new debit cards to you. And in case that trusted person gets the cash for you he can transfer them to you in practically any possible way.
So in short:
P.S. Although I'm not a pensioner but I personally transferred/used my funds using every method I've mentioned above when I moved to the UK having bank accounts in Estonia (but I imagine this should work with most countries).