32 “Also concerning the foreigner who is not from Your people Israel, when he comes from a far country for Your great name’s sake and Your mighty hand and Your outstretched arm, when they come and pray toward this house, 33 then hear from heaven, from Your dwelling place, and do according to all for which the foreigner calls to You, in order that all the peoples of the earth may know Your name, and [q]fear You as do Your people Israel, and that they may know that [r]this house which I have built is called by Your name.
34 “When Your people go out to battle against their enemies, by whatever way You shall send them, and they pray to You toward this city which You have chosen and the house which I have built for Your name, 35 then hear from heaven their prayer and their supplication, and maintain their cause.
36 “When they sin against You (for there is no man who does not sin) and You are angry with them and deliver them to an enemy, so that [s]they take them away captive to a land far off or near, 37 if they [t]take thought in the land where they are taken captive, and repent and make supplication to You in the land of their captivity, saying, ‘We have sinned, we have committed iniquity and have acted wickedly’; 38 if they return to You with all their heart and with all their soul in the land of their captivity, where they have been taken captive, and pray toward their land which You have given to their fathers and the city which You have chosen, and toward the house which I have built for Your name, 39 then hear from heaven, from Your dwelling place, their prayer and supplications, and maintain their cause and forgive Your people who have sinned against You.
40 “Now, O my God, I pray, let Your eyes be open and Your ears attentive to the prayer offered in this place.
41 “Now therefore arise, O Lord God, to Your resting place, You and the ark of Your might; let Your priests, O Lord God, be clothed with salvation and let Your godly ones rejoice in what is good.
42 “O Lord God, do not turn away the face of Your anointed; remember Your lovingkindness to Your servant David.”
I love the first part of this, because even before Solomon brings it up, there is a recurring theme throughout the Bible. God did not choose the Israelites just so he could bless them when they did right, and banish them when they screwed up. No, they were to be a beacon and and example to the whole world.
Thus it was expected that foreigner would indeed come to worship God, in person, or by praying towards the temple later in time (perhaps after going home from a journey to worship God at the temple). His love and blessings were not just for Israel then, and they are not just for those who believe and follow God now.
God expects us to use what he has given us to build His kingdom, to demonstrate His goodness, and to woo others with His love.