The effect of lattice relaxation instability (martensitic transition) on piezoelectric fields (EPE) in spontaneously ordered GaInP2/GaAs epitaxial layers was demonstrated using scanning Kelvin probe microscopy in combination with electron microscopy and optical spectroscopy measurements. The transition manifests itself in the dependence of the surface potential of the epi-layer on the mechanical (cleavage) and thermal (annealing) impacts. This is associated with a switching of the crystal lattice between relaxed and strained martensitic states, corresponding to a change in EPE in the epi-layer. The measured surface potential values (0.2–2.4 V) correspond to EPE within ±100 kV/cm and a strong decrease in |EPE| with increasing layer thickness, indicating the pinning of the Fermi level and piezoelectric doping. Our results open up the prospects for using spontaneously ordered semiconductor alloys to control electronic states in semiconductor nanostructures by controlling their piezoelectric fields.