O you who have believed, do not enter houses other than your own houses until you ascertain welcome and greet1 their inhabitants. That is best for you; perhaps you will be reminded [i.e., advised].
Translation: Saheeh International (English)
1 By the words "As-salāmu ʿalaykum" ("Peace be upon you").
O those who have faith in Allah and act on His sacred law, do not enter houses besides your own houses until you seek permission from their inhabitants to enter them and you greet them, by saying in greeting and seeking permission: “Peace be on you, can I come in?” That seeking permission you have been ordered is better for you than entering suddenly, so that you remember what you have been ordered and then carry it out.