One reason could be societal pressure and expectations. Maybe she feels judged or isolated. Another could be a fear of not being a good mother or not being able to provide a good life for the child.
Often, in such stories, the woman might have underlying mental health issues that are exacerbated by the pregnancy. Or, she could be dealing with a traumatic event related to the pregnancy itself, like a health complication for her or the baby.
Maybe in this fanfiction she experiences a great loss, like the death of a loved one in a very tragic way. For example, if Ron or Harry were killed in a battle and she blamed herself for not being able to prevent it. This overwhelming guilt could be a reason for her to try to kill herself.
If in a Sasuke fanfic, one possible reason could be unrequited love. If Sakura feels that Sasuke will never return her love and she has exhausted all hope, she might sink into despair. Another reason could be if she feels she has failed Sasuke in some way, like not being able to protect him or help him in his goals. Maybe she blames herself for his continued pain or suffering and sees no way out but to end her own life.
Magic or supernatural powers could be another reason. Maybe there is a magical object that, when misused by a man, causes this transformation. It could also be part of a grand design by some higher - power entity in the story's universe to teach the man or society a valuable lesson about gender and pregnancy.
Maybe she was facing extreme emotional distress or felt hopeless in her life.
Another reason could be related to mental health issues. If a woman is suffering from a condition like bipolar disorder and has an episode, she may become violent towards a man without full control of her actions. However, this is not to excuse violence but rather to understand some of the complex factors that could lead to such situations in stories.
Magic is a big reason. As mentioned before, an evil spell from a witch or wizard can cause the transformation. It could be out of spite or as part of a more complex magical plot.
A common reason could be for medical reasons. If a woman has a scalp condition like severe dandruff or psoriasis, shaving the head can be a way to better manage it. It gives easier access to the scalp for treatment.
One reason could be disobedience. If the boy continuously refuses to follow rules set by the woman, like not doing his homework or being rude, she might spank him as a last resort for discipline.
Another reason is for a fresh start. Maybe a woman has gone through a difficult break - up or a major life change and wants to symbolize a new beginning. Shaving her head is a very visible and radical way to show that she is reinventing herself.
One possible reason could be stress. In fanfic scenarios, she might be under a lot of pressure from her scientific research or protecting the Earth. The stress could build up to a point where she starts to harm herself as an outlet.