It was just an arbitrary number and another way to punish prisoners.
From the article:
“Currently, incarcerated women automatically get 12 free pads each month. They must ask an officer if they need more and may possess up to 24 at a time. Unlike in other states, if they want tampons, they must buy them.”