The Prince recognizes the whole tragic situation at the very end of the play. In Act V, Scene iii, he famously states, "All are punish'd." By this he means that all are guilty (especially both families, and even himself) of allowing this tragedy to occur. He also means that both families are being punished for their hatred. A few lines prior, he says, "Capulet, Montague, see what a scourge is laid upon your hate, that heaven finds means to kill your joys with love!"
Friar Lawrence also recognizes the devastation of the tragedy in the same final scene of the play (Act V, Scene iii). He summarizes the events leading up to both Romeo's and Juliet's deaths and then says, "and if aught in this miscarried by my fault, let my old life be sacrific'd...," meaning he feels guilty of the events and is willing to allow the law to take its course upon him.
Lastly, both parents recognize the tragedy in this same scene and make amends.
Unfortunately, all of these characters realize this at the very end of the play. If a single one would have realized earlier, or even been privy to the fact that it was going on, it would not likely have ended as tragically as it did for Romeo and Juliet.
I've included some links below that will help you explore this final scene and your question further.