For the verse:
وَقُلْ رَبِّ أَدْخِلْنِي مُدْخَلَ صِدْقٍ وَأَخْرِجْنِي مُخْرَجَ صِدْقٍ وَاجْعَلْ لِي مِنْ لَدُنْكَ سُلْطَاناً نَصِيراً
And say, "My Lord, cause me to enter a sound entrance and to exit a sound exit and grant me from Yourself a supporting authority." (17:80)
Ibn Kathir cites opinions from Ibn Abbas (RA), from al-Hasan al-Basri, and from Qatadah, and he says this verse refers to the Hijrah (emigration) of the Prophet (SAW) from Makkah to Madinah.
Al-Hasan Al-Basri commented on this Ayah, "When the disbelievers of Makkah conspired to kill the Messenger of Allah, or expel him or imprison him, Allah wanted him to fight the people of Makkah, and commanded him to go to Al-Madinah. What Allah said was: And say, 'My Lord, cause me to enter a sound entrance and to exit a sound exit and grant me from Yourself a supporting authority.' (17:80)"
According to this opinion, the verse is a command to the Prophet to do Hijrah, and the "sound entrance" refers to the entrance into Madinah, and the "sound exit" refers to the exit from Makkah.
Ibn Kathir says this is the most common and most correct tafsir of the verse.
It is also possible to take other meanings. Some of the other opinions I found in my brief reading are:
"Sound entrance" refers to a good death, and "sound exit" refers to a good resurrection.
"Sound entrance" refers to the entrance into the responsibilities of prophethood, and "sound exit" refers to a good exit from life having conveyed the message. (This one would be specific to the Prophet Muhammad himself)
"Sound entrance" refers to the entrance into Islam, and "sound exit" refers to the exit from this world.
However, Hijrah seems to be the most correct explanation of the verse. Allah knows best.