Did Peter and John understand the Scripture that Jesus had to rise from the dead when they saw the empty tomb?
No. At that time, as yet, Peter and John did not know the Scripture that He must rise again from the dead. Even after entering the sepulcher and seeing the linen clothes and the napkin wrapped together, they lacked that understanding.
Les explains from verse nine that at this late time, as yet, Peter and John knew not the scripture that He must rise again from the dead. Peter went into the sepulcher and saw the linen clothes lying there, and the napkin not lying with the linen clothes but wrapped together in place by itself. John, the other disciple, also went in. Despite seeing the empty tomb and the grave clothes, they did not yet understand the scriptural necessity of the resurrection.