- as a sign of repentance and seeking forgiveness for sin
Alma the Younger does say in Alma 5:46
Behold, I say unto you they are made known unto me by the Holy Spirit of God. Behold, I have fasted and prayed many days that I might know these things of myself.I believe he refers to the days of his repentance after seeing an angel. After this event, he immediately starts proclaiming the gospel (see Mosiah 27:32), and it wouldn't makes sense if he waited yet a long time before he obtained a testimony. But if the purpose of his fasting was to receive a remission of his sins, it was not the main purpose or only purpose since the one he states is obtaining a spiritual witness.
In the Old Testament, repentance, fasting and sackcloth often go together. For instance, in Jonah 3:5
The people of Nineveh believed in God, and they declared a fast and put on sackcloth, from the greatest to the least of themIn Helaman 11:9
And it came to pass that when Nephi saw that the people had and did humble themselves in sackcloth, he cried again unto the LordIt is a similar setting with repentance and sackcloth included, but the fasting omitted. Again, even though not explicitly stated, I think there is reason to believe that fasting was part of it.
Even though fasting for your own sins is not mentioned much in the Book of Mormon, fasting on behalf of other sinners is something we read about more frequently. Alma 10:7
As I was journeying to see a very near kindred, behold an angel of the Lord appeared unto me and said: Amulek, return to thine own house, for thou shalt feed a prophet of the Lord; yea, a holy man, who is a chosen man of God; for he has fasted many days because of the sins of this peopleAlma 17:9
And it came to pass that they journeyed many days in the wilderness, and they fasted much and prayed much that the Lord would grant unto them a portion of his Spirit to go with them, and abide with them, that they might be an instrument in the hands of God to bring, if it were possible, their brethren, the Lamanites, to the knowledge of the truth, to the knowledge of the baseness of the traditions of their fathers, which were not correct.Alma 6:6
Nevertheless the children of God were commanded that they should gather themselves together oft, and join in fasting and mighty prayer in behalf of the welfare of the souls of those who knew not God.In the first example, Alma has fasted for the people in Ammonihah, Nephites who had been taught the gospel but rejected it. This is what we typically see in the Bible. Fasting on behalf of someone who needs to repent is almost exclusively done for the people of Israel, those who had been taught the commandments of God. In the other two examples from Alma, the fasting is done for people who "knew not God". Apparently, fasting was used in both of these cases in the Book of Mormon. In Alma 6:6, God had even commanded it. Fasting for someone who "knew not God" is not something I know of in the Bible. This one seems rather unique for the Book of Mormon.