As long as you secure the house and make sure things are turned off etc then you can leave a house unattended for a long time.
But I would recommend that you not leave your house unattended longer than a few months or at least not longer than 6 months at a time.
I would at least get back to the house within a few months to 6 months at most to check on the house and so that it doesn't look like you fully abandoned the house.
Even if you still own the house and have moved permanently and are in the process of selling the house and it's been a year you should come by and check on it at least 6 months later to ensure everything is okay.
If you need to leave your house unoccupied for awhile and it's winter make sure to leave your heating set on at least 55 F or at least to where it won't get below freezing in your house.
That is to ensure no water pipes or anything freezes and bursts in your home.
If it's summer you can keep the A/C on at a high enough temperature to at least keep humidity down in your home.
When it's summer and I leave the house unoccupied even when just away for work I turn the A/C up to the highest setting.
Then I turn it back down when I get home to cool off as it doesn't take too long for it to cool off and it saves me money.
In winter I set the heat temperature to 55 F when I'm leaving the house unoccupied even if it's just to go to work then I turn it back up when I get home.
When you're leaving your house and going on a long vacation you need to do some things to make sure the house doesn't get broken into or doesn't flood etc.
When you leave your house longer than a week or two make sure to shut the water off to the house and if during winter leave your heat on to at least 55 F to keep the house from dipping below freezing.
If your house freezes then you could come back to burst pipes.
Also turn off your water heater and if it's a gas water heater you could put it on the vacation setting or just turn it off completely.
Unplug your dryer as well just in case there might be a rat or something that could chew through the cord and potentially start a fire.
Also if it's summer or mowing season have someone come by and mow your grass often and if you get newspapers have the newspaper stopped.
Also if you get mail delivered to your house have the post office hold your mail or temporary forward the mail until you get back.
Call the non emergency police number and ask if they can check on your house through the time you're gone or have someone such as a trusting neighbor keep an eye on the property while you're gone.
leave your phone number with them so that they can contact you if they need too.
I've been gone for as long as 6 months before and had nothing bad happen to my house while I was gone.
I was only planning on being gone for a month but decided to stay gone longer.
Some people have 2 homes and they can be 1,000 or more miles away and some people have a winter home and some people have a summer home that they leave each home for awhile each year.
So it's possible.