The combination of π-conjugated oxalate anion with sulfate group has been explored in the solvent-free synthesis of two new magnesium sulfate oxalates. One of them has a layered structure crystallized in the noncentrosymmetric space group Ia, while the other has a chainlike structure crystallized in the centrosymmetric space group P21/c. The noncentrosymmetric solid has a wide optical bandgap and exhibits a moderate second-harmonic-generation response. Density functional theory calculations were carried out to disclose the origin of its second-order nonlinear-optical response.