The Catechism in Questions & Answers

517. Was the Holy Spirit already active in the time of the Old Testament?

Yes. As a person of the Trinity of God, the Holy Spirit was, like the Father and the Son, active from eternity. In the old covenant, He filled individual human beings who had been selected by God for specific tasks.

Old covenant and new covenant: see Question 175.

“Then Samuel took the horn of oil and anointed him in the midst of his brothers; and the Spirit of the Lord came upon David from that day forward.”
1 Samuel 16: 13
“Do not cast me away from Your presence, and do not take Your Holy Spirit from me.”
Psalm 51: 11