Moving from one state to another can come with so many responsibilities that you may actually forget to change your car insurance policy. Sometimes, your job may require you to work in a different state for months at a time. When you are in a situation such as this, your insurance company will have special options to cover you. You need to talk to your insurance agent about it.
If a car is driven in a state for more than 90 days a year, it needs insurance for the state. If you have a vacation home in a different state, and you visit the state on a regular basis, you have two options. You may either buy insurance for each state with a company that does business in multiple states, and get a discount in the process, or ask for a special vacation home discount. Some people laboriously go through the process of canceling their car's registration in one state, and applying for new registration in the other state, and repeat the process each year.
When you are in the military and need to travel to a different state as part of your service, your car insurance is always supposed to be for your home state, rather than the state in which you are stationed.
When you live in more than one state for extended periods of time, buying insurance for multiple states is the safest way to go. You may be able to get a discount if you explain the situation to the insurance company, however. Shopping around and getting multiple quotes is always a good practice to ensure you have an understanding of the market rates for your situation.