The share of the renewable energy sources (RES) in the global electricity market is substantially increasing as a result of the commitment of many countries to increase the contribution of the RES to their energy mix. However, the integration of RES in the electricity grid increases the complexity of the grid management due to the variability and the intermittent nature of these energy sources. Energy storage solutions such as batteries offer either short-term storage that is not sufficient or longer period storage that is significantly expensive. This paper introduces an energy management approach which can be applied in the case of power and desalinated water generation. The approach is based on mathematical optimization model which accounts for random variations in demands and energy supply. The approach allows using desalination plants as a deferrable load to mitigate for the variability of the renewable energy supply and water and/or electricity demands. A mathematical linear programming model is developed to show the applicability of this idea and its effectiveness in reducing the impact of the uncertainty in the environment. The model is solved for the real world case of Saudi Arabia. The optimal solution accounts for random variations in the renewable energy supply and water and/or electricity demands while minimizing the total costs for generating water and power.