Reasons will vary greatly by whom you look to, but this older answer of mine might be of interest for one specific slice.
I've answered a couple of relevant questions here. First, one on why ordinary Spaniards might have volunteered (as opposed to getting conscripted) to fight for the Nationalist side. Second, how serving members of the military made the decision to fight or stay loyal at the very beginning of the civil war.