Compliance in robot design and control is often introduced to improve the robot performance in tasks where interaction with environment or human is required. However a rigorous method to choose the correct level of compliance is still not available. In this work we use robust optimization as a tool to select the optimal compliance value in a robot-environment interaction scenario under uncertainties. We propose an approach that can be profitably applied on a variety of tasks, e.g.manipulation tasks or locomotion tasks. The aim is to minimize the forces of interaction considering model constraints and uncertainties. Numerical results show that: i) in case of perfect knowledge of the environment stiff robots behave better in terms of force minimization, ii) in case of uncertainties the optimal stiffness of the robot is lower than the previous case and optimal solutions provide a faster task accomplishment, iii) the optimal stiffness decreases as a function of the uncertainty measure. Experiments are carried out in a realistic set-up in case of bi-manual object handover.