Yes, you can leave the UK while on a spouse visa, but it's important to maintain a strong connection to the UK by not spending excessive time abroad.