This paper studies a two-stage scheduling optimal strategy for virtual power plant (VPP) participation in both day-ahead and real-time electricity markets, as well as the carbon market, with the aim of maximizing economic benefits. A two-stage robust stochastic optimal scheduling model is adopted to simulate the scheduling process of VPP participation in day-ahead and real-time markets. The scenario-based stochastic optimization method is used to handle the uncertainty of electricity prices, while the uncertainty of wind and solar renewable energy generation is described by using box uncertainty sets. The model considers the worst-case scenarios of renewable energy output to adjust the day-ahead scheduling plan in real-time market stage. It also incorporates the participation of VPP in carbon trading market with a stepped carbon pricing mechanism, aiming to reduce carbon emissions while ensuring the economic benefits of the VPP. Experimental results show that the proposed model can effectively address renewable energy uncertainty, integrate fluctuation scenarios of electricity price, and maximize the profit of VPP through day-ahead and real-time scheduling. Additionally, the carbon trading price mechanism helps reduce carbon emissions during operation and enhances the sustainability of the VPP.