Looking at the Old Testament with our knowledge of the New, we can see that the Trinity was foreshadowed, but it was not taught in terms of one God in three Persons. Christ revealed the doctrine of the Trinity to his disciples; it is a doctrine that would have remained unknown to us unless God had revealed it.
The Old Testament suggests that the Holy Spirit is God. There are passages that show that the Spirit is a Person—for example, when the Spirit speaks (cf. 2 Sm 23:2; Ez 2:2, 3:24, 11:5). Also, there are passages that show the Spirit has divine attributes such as omnipresence (Ps 139:7).
One of the most commonly cited intimations of the doctrine of the Trinity is that God speaks to himself in Genesis by using a plural: "Let us make man in our image," and then we read "in the image of God he created him" (Gn 1:26-27).
The triple cry of the seraphim in Isaiah—"Holy, holy, holy is the Lord of hosts" (Is 6:3)—is thought to reflect the Trinity.
Some have seen the appearance of the three men to Abraham in Genesis 18 as a manifestation of the Trinity, though this in unclear. Genesis 19:1 seems to refer to two of the three men as angels.
It seems that there may have been some idea of plurality within the Godhead before the time of Christ, but the doctrine of the Trinity had not yet been made fully clear.