This is not a problem at all morally, if the procedure was done for a medically necessary purpose.
I'm no moral theologian, but basically you draw the lines as follows: when a person makes himself/herself intentionally sterile, that is where sin comes in. When the person is unintentionally sterile (defect, disease, wrong time of month) there can be no sin, because there is no intent.
So what about a spouse sterilizing themselves to prevent their loved one from becoming pregnant, which puts them at risk medically?