Robotic grinding relies on precise force control to ensure material removal precision and surface quality, particularly in thin-walled workpieces with varying stiffness. This paper introduces a novel electromagnetic variable stiffness actuator (EMVSA) designed to adjust the grinding force on variable-stiffness workpieces by modifying the actuator stiffness. The decoupling control of force and stiffness is achieved at the hardware level through the design of the EMVSA with Lorentz motor (LM) and electromagnetic variable stiffness spring (EVSS). The EVSS, with a +/- 15 mm displacement, addresses challenges in displacement and stiffness control for robotic grinding. Utilizing electromagnetic and finite element models of the EMVSA, optimization functions are established, followed by an analysis of physical constraints and parameter decoupling. A physically feasible united optimization method for 23 parameters ensures solution viability and comprehensiveness. A prototype of EMVSA is developed for performance evaluation. The output force constant of the LM has a 1.28% error compared to simulation results, and the EVSS stiffness coefficient shows a linearity of 0.9991, aligning with the theoretical design. Furthermore, an environmental stiffness estimation method is integrated with the active control of the EMVSA, and a robotic grinding platform incorporating the EMVSA is constructed. Compared with the series elastic actuator and EMVSA without variable stiffness control, the EMVSA with variable stiffness control reduces the average absolute error of material removal depth by 60.49% and 20.63%, respectively, and reduces the surface roughness by 59.12% and 31.96%, respectively. The results demonstrate the effectiveness and advantages of the developed EMVSA for robotic grinding.