SB 5.19.5

martyāvatāras tv iha martya-śikṣaṇaṁ
 rakṣo-vadhāyaiva na kevalaṁ vibhoḥ
kuto ’nyathā syād ramataḥ sva ātmanaḥ
 sītā-kṛtāni vyasanānīśvarasya
Word for word: 
martya — as a human being; avatāraḥ — whose incarnation; tu — however; iha — in the material world; martya-śikṣaṇam — for teaching all the living entities, especially human beings; rakṣaḥ-vadhāya — to kill the demon Rāvaṇa; eva — certainly; na — not; kevalam — only; vibhoḥ — of the Supreme Personality of Godhead; kutaḥ — from where; anyathā — otherwise; syāt — there would be; ramataḥ — of one enjoying; sve — in Himself; ātmanaḥ — the spiritual identity of the universe; sītā — of the wife of Lord Rāmacandra; kṛtāni — appearing due to the separation; vyasanāni — all the miseries; īśvarasya — of the Supreme Personality of Godhead.
Translation: 
It was ordained that Rāvaṇa, chief of the Rākṣasas, could not be killed by anyone but a man, and for this reason Lord Rāmacandra, the Supreme Personality of Godhead, appeared in the form of a human being. Lord Rāmacandra’s mission, however, was not only to kill Rāvaṇa but also to teach mortal beings that material happiness centered around sex life or centered around one’s wife is the cause of many miseries. He is the self-sufficient Supreme Personality of Godhead, and nothing is lamentable for Him. Therefore why else could He be subjected to tribulations by the kidnapping of mother Sītā?
Purport: 

When the Lord appears in this universe in the form of a human being, He has two purposes, as stated in Bhagavad-gītāparitrāṇāya sādhūnāṁ vināśāya ca duṣkṛtām: to destroy the demons and protect the devotees. To protect the devotees, the Lord not only satisfies them by His personal presence but also teaches them so that they will not fall down from devotional service. By His personal example, Lord Rāmacandra taught the devotees that it is better not to enter married life, which is certainly followed by many tribulations. As confirmed in Śrīmad-Bhāgavatam (7.9.45):

yan maithunādi-gṛhamedhi-sukhaṁ hi tucchaṁ
 kaṇḍūyanena karayor iva duḥkha-duḥkham
tṛpyanti neha kṛpaṇā bahu-duḥkha-bhājaḥ
 kaṇḍūtivan manasijaṁ viṣaheta-dhīraḥ

Kṛpaṇas, those who are not advanced in spiritual knowledge and who are therefore just the opposite of brāhmaṇas, generally take to family life, which is a concession for sex. Thus they enjoy sex again and again, although that sex is followed by many tribulations. This is a warning to devotees. To teach this lesson to devotees and to human society in general, Lord Śrī Rāmacandra, although the Supreme Personality of Godhead Himself, underwent a series of tribulations because He accepted a wife, mother Sītā. Lord Rāmacandra underwent these austerities, of course, only to instruct us; actually He never has any reason to lament for anything.

Another aspect of the Lord’s instructions is that one who accepts a wife must be a faithful husband and give her full protection. Human society is divided into two classes of men — those who strictly follow the religious principles and those who are devotees. By His personal example, Lord Rāmacandra wanted to instruct both of them how to fully adopt the discipline of the religious system and how to be a beloved and dutiful husband. Otherwise He had no reason to undergo apparent tribulations. One who strictly follows religious principles must not neglect to provide all facilities for the complete protection of his wife. There may be some suffering because of this, but one must nevertheless endure it. That is the duty of a faithful husband. By His personal example, Lord Rāmacandra demonstrated this duty. Lord Rāmacandra could have produced hundreds and thousands of Sītās from His pleasure energy, but just to show the duty of a faithful husband, He not only rescued Sītā from the hands of Rāvaṇa but also killed Rāvaṇa and all the members of his family.

Another aspect of the teachings of Lord Rāmacandra is that although Lord Viṣṇu, the Supreme Personality of Godhead, and His devotees may apparently suffer from material tribulations, they have nothing to do with such tribulations. They are mukta-puruṣas, liberated persons, under all circumstances. It is therefore said in the Caitanya-bhāgavata:

yata dekha vaiṣṇavera vyavahāra duḥkha
 niścaya jāniha tāhā paramānanda-sukha

A Vaiṣṇava is always firmly situated in transcendental bliss because of engagement in devotional service. Although he may appear to suffer material pains, his position is called transcendental bliss in separation (viraha). The emotions a lover and beloved feel when separated from one another are actually very blissful, although apparently painful. Therefore the separation of Lord Rāmacandra from Sītādevī, as well as the consequent tribulation they suffered, is but another display of transcendental bliss. That is the opinion of Śrīla Viśvanātha Cakravartī Ṭhākura.