Generally, a citizen of a foreign country who wishes to enter the country must first obtain a visa, either a non-immigrant visa for temporary stay, or an immigrant visa for permanent residence. The visa allows a foreign citizen, to travel to the country.
A visa is a document showing that a person is authorized to enter the territory for which it was issued, subject to permission of an immigration official at the time of actual entry. The authorization may be a document, but more commonly it is a stamp endorsed in the applicant's passport. Some countries do not require a visa in some situations, such as a result of reciprocal treaty arrangements.
The country issuing the visa typically attaches various conditions of stay, such as the territory covered by the visa, dates of validity, period of stay, whether the visa is valid for more than one visit, etc. A visa does not generally give a non-citizen any rights, including a right to enter a country or to remain there. The possession of a visa is not in itself a guarantee of entry into the country that issued it, and a visa can be revoked at any time. The visa process merely enables the host country to verify the identity of the visa applicant before, rather than coincident with, the entry of the applicant.
Some countries require that their citizens, and sometimes foreign travelers, obtain an exit visa in order to be allowed to leave the country.