She was sterilized.
"You know what my final test was in the Red Room? They sterilized me. Said it was one less thing to worry about."
Natasha Romanoff, Avengers: Age of Ultron
We don't know the exact procedure undertaken as part of the Red Room training, we just know that she is no longer capable of having children, as the people who trained her wanted to make sure that nothing would ever get in the way of her being able to complete a mission.
We don't have any more detail than that, and I think that's deliberate - a scene showing a woman being forcibly sterilized might be a bit heavy for a superhero movie, don't you think?