An attempt is made to study the carrier contribution to the elastic constants in the presence of an arbitrarily oriented quantizing magnetic field in nonlinear optical materials on the basis of a new electron dispersion law allowing various types of anisotropies within the framework of k. p formalism, incorporating spin and broadening. We have also investigated the said contribution in III-V, II-VI and IV-VI optoelectronic compounds in accordance with the appropriate band models considering the different significant features of the energy band spectra on the basis of k. p theory. It is found, taking a few numbers of the said compounds that the carrier contribution to the second and third order elastic constants increases with increasing electron concentration in an oscillatory way and exhibits oscillatory dependence with inverse quantizing magnetic field due to acoustic SdH effect. The contribution increases with the decreasing alloy composition for ternary and quaternary compounds respectively. The theoretical formulations for III-V and nonlinear optical compounds are in quantitative agreement with the suggested experimental methods of determining the second and third order elastic constants for materials having arbitrary dispersion laws. In addition, the corresponding well-known expressions for wide gap materials have also been obtained as special cases of our generalized formulations under certain limiting conditions.