The indwelling of the Holy Spirit in Old Testament times was selective and temporary. He was nevertheless working in the lives of people to do much of the same type of thing as seen in John 16:8-11, though the object of faith was different. In the Old Testament there was the anticipation of the coming of Christ through the tabernacle, priesthood, and sacrifices. The point is that the Holy Spirit worked in the hearts of people to enlighten, convict, and lead people to believe the content of the message as it existed in Old Testament times. The Holy Spirit obviously had to regenerate people and He led them, but it was not from the indwelling presence as it is today.
Scripture actually does not give us a great deal of detail on this. He was obviously at work in the lives of many in a powerful way as we see, for instance in Zechariah 4:6f. Another illustration that pertains to salvation for those not immediately associated with Abraham or Israel is Melchizedek. We do not know where Melchizedek got his information or how he became a priest of God, but he was a believer and even a type of Christ (Gen. 14 and Heb. 7).
I have included below, a section from Ryrie’s Basic Theology which I think will answer most of your questions.
III. THE SPIRIT’S WORK IN RELATION TO PEOPLE
The Spirit’s ministry to people in Old Testament times was not the same as it has been since the Day of Pentecost. Whatever it was, the Lord made it quite clear it would be different after Pentecost. Notice how repeatedly the Lord spoke of the “coming” of the Spirit (who was already present) in His conversation with the disciples in the Upper Room (John 15:26; 16:7-8, 13). This indicates both that the Spirit was at work then and that His work would take on a different character after Pentecost. When the Lord summarized that contrast He said the Spirit “abides (present tense) with (para) you and will be (future tense) in (en) you” (14:17). While there is an alternative reading of the present tense in the second clause, i.e., is in you, most commentators prefer the future tense.
This, of course, delineates the contrast between the ministry of the Spirit at the time the Lord spoke these words and the future ministry after Pentecost. Buswell, wishing to blunt that contrast, translates the en as “among,” making the promise mean that the Spirit would be among the company of disciples. He does acknowledge that it might be construed to mean “in you individually” (Systematic Theology [Grand Rapids: Zondervan, 1962], 1:115). Many commentators simply seem to be unaware of any distinction being made here. F. Godet’s comment is to the point.
“The preparatory operation of the Spirit upon the disciples is expressed by the words: ‘He dwelleth with you’; and the closer relation into which He would enter with them at Pentecost by: ‘He shall be in you.’ Hence we must be careful neither to read with the Vulgate, menei in the future, He shall dwell in the first proposition, nor with some Alexandrines, esti, is, in the second. The whole meaning of the phrase consists in the antithesis of the present dwelleth (comp. menon in v. 25) and the future shall be. The contrast of the two regimens with you (comp. Par’ humin of v. 25) and in you corresponds exactly with that of the tenses” (Commentary on the Gospel of St. John (Edinburgh: T. & T. Clark, 1881], 3:141).
With this contrast in mind, we need to try to delineate and systematize what the Spirit did for people in Old Testament times.
A. The Nature of His Work
Three words seem to explain the Spirit’s ministry to people in the Old Testament.
1. He was in certain ones. Pharaoh recognized that the Spirit was in Joseph (Gen. 41:38). Likely Pharaoh did not understand this was the Holy Spirit, but later revelation seems to make this clear. The Spirit was in Joshua which is why God chose him (Num. 27:18). The Spirit was in Daniel (Dan. 4:8; 5:11-14; 6:3). In these instances the preposition used is beth, “in.”
2. The Spirit came upon some. The preposition used to depict this is al. A number of people experienced this ministry of the Spirit (Num. 24:2; Judges 3:10; 6:34; 11:29; 13:25; 1 Sam. 10:10; 16:13; 2 Chron. 15:1). These included judges, Saul, and the prophets Balaam and Azariah.
3. The Spirit filled Bezalel. (Ex. 31:3; 35:31). This seemed to be a special enablement to lead the craftsmen as they worked on the tabernacle.
B. The Extent of His Work
1. Limited as to people. After God chose Israel to be His people, the Spirit’s work was with that group primarily if not exclusively. Israel, of course, was a spiritually mixed nation with unbelievers as well as believers. Yet the Spirit ministered to the entire nation by being present and guiding the people (Neh. 9:20; Isa. 63:10-11, 14). This seemed to be a general relationship. There were apparently closer relationships He had with some within the nation (see above and Num. 11:29).
However, we do not have clear revelation of the Spirit’s ministry outside of Israel. Genesis 6:3 may be an exception if the verse means that the Spirit judged mankind for its wickedness in the days of Noah. But the verse may be a warning that the human spirit God placed in human beings would not always abide because mankind would be wiped out in the Flood. Certainly there was no indication that the Spirit convicted the world of sin in Old Testament times (as He does now, John 16:8), and no other nations enjoyed His general presence among them as Israel did. As far as the record is concerned His ministry was to Israel and individuals in Israel.
2. Limited as to kinds of ministry. As stated above, we find no ministry of general conviction, no indwelling and empowering as after Pentecost (7:37-39), no sealing, and certainly no baptizing (it is still future in Acts 1:5). Regeneration of the Spirit is not mentioned specifically, though some feel that the Spirit was regenerating in the Old Testament because believers give evidence of a struggle within their beings brought on by the presence of both the old and new.
3. Limited as to eternality. The Spirit empowered Samson; later the Lord left him (Judges 13:25; 16:20). The Spirit came on Saul and later left him (1 Sam. 10:10; 16:14). Apparently there was no guarantee of permanent presence of the Spirit in Old Testament times.
Perhaps I could draw an analogy between the Spirit’s ministry in the Old Testament and grace in the Old Testament. Both were present during that period, but the Spirit who worked in the Old Testament would “come” in new and fuller ministries after Pentecost, just as the displays of grace in the Old Testament were dim compared with grace that flooded the world when Christ came (John 1:17; Titus 2:11).
Regarding faith and salvation in the Old Testament, Ryrie says:
Faith was the necessary condition for salvation in the Old Testament as well as in the New. Abraham believed in the Lord and the Lord counted it to him for righteousness (Gen. 15:6). The Hebrew prefix beth indicates that Abraham confidently rested his faith on God (cf. Ex. 14:31; Jonah 3:5). The covenant relationship established by the Mosaic Law also implied that an Israelite had to have faith in the God of that covenant if he were to be pleasing to Him and not be cut off.
The object of faith was always the true God (Num. 14:11; 20:12; 2 Kings 17:14, Ps. 78:22, Jonah 3:5). This Savior God was the sole origin of salvation (Ps. 3:8, Jonah 2:9). To trust in idols was not only ineffective but ludicrous, for salvation was of the Lord.