Some people in ancient Israel had access to some books of scripture. In Mesoamerica, they typically could have written on fig bark. They would not have been able to get all the scriptures on one of those fig-bark books, so they probably had selections or portions copied onto different books. The official, complete record, from which copies were made, would have been kept in the Temple. Literacy in the ancient world was generally low. Being able to read and write was a professional skill in most ancient societies.
Under the Law of Moses, at the Feast of Tabernacles each year, and with the special emphasis on the seventh year, the leaders would read the law aloud to everyone. While the average person may not have been able to read, they would have at least heard the law repeated periodically. They may also have had a reading cycle. In Jewish worship, they go through the entire Old Testament week by week throughout the year, and then the next year they would go through it again. There may have been a liturgical cycle of that nature.
Because literacy in the ancient world was low, there was a very strong oral tradition. People learned how to memorize and quote texts precisely, as we see Alma doing in this chapter. A young boy preparing to become a man—to go through his bar mitzvah or whatever their equivalent would have been—would likely have had to memorize and know scriptures by heart. They may not have had much access to written copies, but they certainly had access verbally, and were able to repeat these things, as we see Alma doing here.
Book of Mormon Central, “Why Did Book of Mormon Prophets Quote Long Passages of Scripture? (1 Nephi 19:22),” KnoWhy 473 (October 4, 2018).
Brant A. Gardner, “Literacy and Orality in the Book of Mormon,” Interpreter: A Journal of Latter-day Saint Faith and Scholarship 9 (2014): 29–85.