Yes, as long as you are doing a work exchange and not getting paid. Some countries require specific visas for volunteer work, so check if you need any other paperwork before travelling. If you get asked at immigration what you’re going to be doing in the country, it’s safer to say travelling than doing a work exchange – things can get tricky as soon as you mention the word “work”.