Sodium-niobium borophosphate glasses have been thermally poled and studied in the mid- and far-infrared range to probe their possible structural rearrangements and to correlate them with the measured nonlinear optical (NLO) response. The infrared analysis of thermally poled and depoled glasses has revealed systematic structural changes in the NLO-active space charge layer at the anode on the basis of which we suggest that sodium ion migration from this layer is accompanied by an equivalent migration of oxide ions. Ion depletion in the NLO layer induces extensive, but partially reversible by depoling, modifications of the phosphate and niobate parts of the network that depend on the composition of the glass. Second harmonic generation measurements have demonstrated that the second-order optical properties are generated only within the space charge layer at the anode where structural rearrangements are effected by thermal poling.