For state return, you need to check each states filing instructions. The rules are all different. Typically, state return choose the same filing status as your federal return (if federal is joint, state will choose joint too). But, some states have rules saying if one of you are not considered the resident of that state, you can not file joint return. Some have 'partial resident' definitions. Some may even require you to file a return under certain situations, even when you are not defined as the resident of that state.
Just find the filing instructions for both A and B states and follow the rules.