Yes, Newton's second law can be extended to systems with varying masses. In such cases, the net force acting on the system is still equal to the product of the total mass and the acceleration of the center of mass of the system. This principle is applicable to systems like rockets, where the mass changes over time due to the expulsion of propellant.