Electrons are pulled from the valence shell. As the quantum number increases, the distance of that shell from the nucleus increases. Therefore, electrons are pulled from 4s before 3d which is held tighter to the nucleus. There are exceptions to this rule.
Fe is +2 or +3; where +2 means an empty 4s shell and +3 means an empty s shell and one removed from the d shell giving half filled stability. No matter the charge, electrons in this case are removed from the 4s first.