Sometimes diseases that affect the entire body, such as heart disease and kidney or liver failure, can result in excess fluid buildup (edema) that is often concentrated in the legs and feet, leading to swelling not only of the ankles but also of the feet and lower legs. This can also occur with pregnancy.