Both of these quotes are desperate attempts to deny the truth, refusals to recognize the horrible reality of the depths of the boys' descent into savagery.
In Chapter 10, when Piggy insists that Simon's death was an accident, he is ironically trying to comfort Ralph, who at that point is hit with full awareness of what is happening. When Ralph repeats the words in Chapter 12, he is trying to reason his own way out of his awareness that the boys really have crossed the line into a state of evil he had not known even existed - "he argued unconvincingly...(but) the final unreasoning knowledge came to him...the breaking of the conch and the deaths of Piggy and Simon lay over the island like a vapor...these painted savages would go further and further".
Although in Chapter 12 Ralph is speaking specifically about the deaths of Piggy and Simon, in a larger sense he is addressing the whole phenomenon of the tribes total degeneration. He had not meant for it to happen and had in fact tried to prevent it from happening, but it happened anyway - "It was an accident". there were forces at work beyond his understanding and strength to counteract. As Ralph knows and expressed to Piggy in Chapter 10 with the admission, "I was - I don't know what I was", he too had felt the appeal of abandon, and had almost been drawn into the abyss himself.