One question, why do you assume that she knew he would walk away? I mean, many men make promises when they want to have sex and then, some keep those promises and others don't.
Some women think that if they get pregnant, the men would marry them. Specially if they are young and naive. Or conservatives. The fact that everyone expected him to be at the naming of the child suggest that in that country, the "norm" is for a couple to marry if a woman gets pregnant.
Sure, we progresives are more cynic and probably won't trust the man. But we are heavily critiziced for pointing that some men lie and make false promises.
Honestly? It seems to me that he simply didn't care about the consequences, while she thought that getting pregnant would make him commit because we have seen this story many times and it is quite common.