Cherry had already befriended Pony after he and Johnny defended her against Dally's aggressive come-on at the movie theatre. She bonded with Pony, and they both discovered a mutual love of sunsets. Cherry was horrified when she found that Johnny had been beaten by a Soc with a fistful of rings on his fingers, knowing that it had to be her boyfriend, Bob. She believed the true story about Bob's death, knowing that his violent tendencies would have led him to just such a predicament. Combined with her desire to end the violence between the Socs and greasers, and her admiration for the boys' heroic actions at the church, Cherry was more than willing to stand up for Pony at the hearing.
Randy was genuinely tired of all the violence, and though it was his best friend who was killed by Johnny, he recognized that the truth was the best way to help Pony. Randy also befriended Pony following the church fire, wanting to know for himself why a greaser would do such an honorable thing. Randy saw that Pony was better than him.
"I would have let those kids burn to death,"
Randy tells Pony. But Pony likes Randy--it's his first positive contact with a Soc--and he disagrees, telling Randy that he would have done the same thing as Pony. Randy refuses to take part in the rumble, and his appearance at the hearing is his way of making amends to Pony--and himself--for his prior violent actions against the greasers.
"... it's the first time I've felt anything in a long time."
*Why did Randy and Cherry support Ponyboy and Johnny in when they testified in court?