When the Lord incarnates as a human being, He is not bound by any karma or sorrow, as is with the case of all others right from Brahma to the smallest ant. Out of His Sankalpa and His yoga, He takes a human or any other form to protect the good, quell adharma, establish dharma, and restore order in the universe. His empathy for the jivatmas is clear when He chooses a human form to live among them and by example teaches them many lessons for life and salvation, pointed out Sri Krishnamurthy Sastrigal in a lecture.
For instance, in the Ayodhya Kanda, much valuable advice and guidance for those who wallow in sorrow is embedded in Rama’s wailing about the life of solitude in store for Him. The truth, that all are born in this samsara to expiate for their past karma, good and bad, is explained when Rama analyses Kausalya’s state.
Rama feels for Kausalya on whom He has inflicted endless sorrow. At a time when she has to be looked after by her son whom she had nurtured since birth, she now only faces the pangs of separation. Even the pet myna which Kausalya rears would be more affectionate and kind than Him. Being childless would have been a better option than bringing forth such an unfortunate son as Him.
He attributes Kausalya’s mental anguish to some past deeds of hers that are now bearing fruit. Maybe in her previous births she must have been the cause of separating mother from son. The effects of past actions are felt as joy and sorrow by all in the course of time. There is no escape from this bond of karma. He then proclaims that if He wishes He can win over Ayodhya single-handedly and become the ruler. But Rama restricts Himself since it is the path of adharma and will lead to further sin.