(condensed from Ein Ayah, Shabbat 2:51)
Gemara: [At the inauguration of the Beit Hamikdash, the people were happy] "for all the good that Hashem did for His servant David" (Melachim I, 8:66) – that David was forgiven for that sin [of Batsheva] – "and for His nation, Israel" – that He forgave them for the sin of Yom Kippur (as they ate during the festivities of the inauguration).
Ein Ayah: [This piece includes difficult concepts that are liable to be misunderstood.]
Taking everything into consideration, one will see that the distinction between good and bad exists only in regard to the specific: whether person, time, or situation. Regarding the general, though, Chazal already said: "Just as the praise of Hashem emerges from the righteous, so does it emerge from the wicked" (Nidda 45b). That which things that are innately bad bring bad to their perpetrators is because they act as individuals, while bad can actually be the cause of good in the future. Therefore, the above was rightfully made clear at the inauguration of the Beit Hamikdash, which demonstrates the sanctity of Hashem’s unity and the scope of Divine Providence.
Chazal tell us that Hashem allowed David to sin in order to teach the efficacy of teshuva (repentance). This is related to the idea that bad can be turned into good and even produce results that could not have been reached through good alone. The uniquely elevated time of the inauguration was fit to teach this concept by showing that David’s sin had been forgiven, which impacted on the treatment of his offspring. While showing the workings of teshuva has some practical elements, it is related to the following outlook that cannot be grasped practically. On a certain level, sin and the loss it causes do not exist. This is because even the bad that is done by evil people is part of the overall plan that will ultimately perfect the world. This should not encourage immorality because the individual is required to follow the "path of the straight."
The above idea also raises the image of justice, which is appreciated when one realizes that even evil is good, from a certain perspective, and was included in the creation of the world. Just as the world is improved when good befalls those good people, so is it improved when bad befalls sinners. Thus the element of sin that is related to loss and deterioration applies only to the individual sinner, not to the world in general.
Therefore at the great moment of inauguration, the epitome of the communal and eternal, the above ideas also had to be brought to the fore. Therefore, Yom Kippur was not practiced as usual. This showed that the exalted, holy, and eternal institution of the Beit Hamikdash combines within it all the inclusive matters that have been, are, and will be. On that level, we do not relate to the loss caused by sin, and there is, therefore, no need for kapara (atonement). The above is only on a philosophical level, as practically we need kapara, which has an important standing, as the individual receives it, and the collective is thus impacted. However, curtailing Yom Kippur’s practices (i.e., permitting eating) demonstrates that through the strength of Hashem’s unity we will see the triumph of absolute good, as the pasuk says: "I will erase your sins for My sake, and I will not recall your sins" (Yeshaya 43:25). That is why Hashem forgave Bnei Yisrael for the "sin" of curtailing Yom Kippur. This showed Hashem’s confidence in the eternal choice of Israel as His nation, which made it unnecessary to fear that individual moral mistakes will extinguish the flame, which even great waters cannot do (see Shir Hashirim 8:7).
Thus, it will be seen that there are no absolute evils; all is relative to time and place, and over eternity all will work out for the best, as Hashem has plans for Israel’s welfare. That is why at the time of the development of the relationship with Hashem, with the Beit Hamikdash, Hashem demonstrated His willingness to forgive the people.