After he failed or passed the second one, he could not enter anymore. How did this happen? And, is there a way to get back the ability?
I will grant you the right to face the trial of the Sanctuary.
While placing her hand over his chest, Echidna said this to Subaru at their very first meeting, just before sending him back (Episode 3, first half of second season). This was the reason Subaru was able to enter the trial of the Sanctuary in the first place, despite not being a half demon (a qualification needed to enter the trial).
In the last episode of the first half of the 2nd season, Echidna took this ability away from him after Subaru refused to form a contract with her, again by briefly placing her hand near his chest.
Unless Echidna decides to give this ability back to Subaru, there's no way for him to enter the trial again.
TL;DR: Echidna giveth, and Echidna taketh away.