Stories tells that a woman had sex with someone else than her husband. Maybe she did not even have a husband. She then get pregnant and gave birth to a baby. This way to make a baby was not accepted by church and society - that kind of baby is called bastard. Mother had to kill her bastard child to avoid being blamed by priests or other people. Mother then buried child outside graveyard and without priests blessing the body. Soul of baby could not go to heaven because his/her body was not at graveyard and was not blessed by a priest. This is why she became a ghost.
This ghost could make terrible noise until somebody dugs up his/her body and buries it in graveyard. Such ghost people call Ihtiriekko. Ghosts could also be quiet, but she/he might be seen as a flame in forest, like will o' the wisp. Such ghost people call Liekkiö.