It will not be fully correct to say that Rama denounces Sita two times in Ramayana. But let me first explain which two times we are referring to in the story.
As we know, Ravana kidnaps Sita deceitfully and Rama fights and wins a grand war with Ravana to rescue her. She returns back to him and this is the first time he thinks she could have become corrupted or unchaste. But look at Rama’s situation. He is a king. He is at a high, honorable position. His people believe in his values. He cannot afford to be wrong. Sita, his wife, spent almost a year at another man’s place (a man who kidnapped her with the intent of having sexual relationship with her). No one had the information of how Sita was treated at Ravana’s palace. And this is coupled with the fact that Ravana was evil and immoral. He was madly attracted to Sita and did a heinous job of forcefully abducting her in Rama’s absence. Is it too much, then, to suspect that Ravana would have tried to sexually assault Sita? I don’t think so. We, as readers, know that Sita took the help of Gods to protect her from Ravana during the entire stay at Lanka. And she remained pure and uncorrupted.
Chastity was considered a valuable, prized position in earlier times (and, in fact, even today!). Rama had to put Sita to an agni pariksha which was some kind of a chastity test. So if Ravana defiled Sita, she would fail the test and get burned in the fire. Rama doesn’t want to do this to Sita and neither does he denounce her from inside. But his kingly honor forces him to do such a thing. Rama knew if he accepted Sita without confirming her chastity, he would lose the honor of a king when he returned back to his palace.
The second time Rama condemns Sita is when Rama overhears a “commoner” comparing his immoral wife to Sita. It is to protect his family's respect that he abandons Sita and asks his brother to drop her to an ashram in a forest. Note that though this looks like a strong unloving act, it is actually Rama’s misery. We are told that Rama stops living the life of a king after he distances him from Sita. He stops enjoying all the luxuries of life. He feels deep remorse and misses her badly. Rama never himself believes that Sita is corrupt, defiled or evil. He just condemns her because of his courtly honor. Of course, this looks like a trivial justification in today’s world where people aren’t really bothered about bothered about what others say. But things were different at that time.
Sita is deeply hurt by Rama’s decisions. She never really forgives Rama for all this. If we look through Sita's perspective, this was a lot of injustice. But considering Rama's situation, I think he had no other option. Even today, Indian women pray to get a husband as loving, loyal and committed as Rama. Rama and Sita are an archetype of unconditional, supreme form of love.