Why was it said Salvation is only through Jesus?
Because the scriptures clearly teaches it in the famous verse in John Gospel;
John 3:16 New International Version (NIV)
16 For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
But the Jews living before the time of Jesus Christ believe they can be save by God not thru Jesus Christ but as King Solomon professed the Jews can be saved by Wisdom.
Solomon’s Prayer for Wisdom
“O God of my ancestors and Lord of mercy,
who have made all things by your word,
and by your wisdom have formed humankind...
Who has learned your counsel,
unless you have given wisdom
and sent your holy spirit from on high?
And thus the paths of those on earth were set right,
and people were taught what pleases you,
and were saved by wisdom.”
King Solomon profess that the Jews are saved by Wisdom.
We can also relate salvation of other religions not only Jews in the recent words of Pope Francis;
Freedom is a right of every person: each individual enjoys the freedom of belief, thought, expression and action. The pluralism and the diversity of religions, colour, sex, race and language are willed by God in His wisdom, through which He created human beings. This divine wisdom is the source from which the right to freedom of belief and the freedom to be different derives. Therefore, the fact that people are forced to adhere to a certain religion or culture must be rejected, as too the imposition of a cultural way of life that others do not accept;
This words "The pluralism and the diversity of religions, colour, sex, race and language are willed by God in His wisdom", is the answer to your particular question on those people living before Jesus Christ.
While the bible teaches that there are no other names given in Heaven on which man can be save, but the Old Testament clearly teaches that people can be save by Wisdom.
Is there a contradiction between the gospel and old testament scriptures? None, why?
St.Paul teaches Jesus is the Wisdom of God. So the people in the old testament embracing the Wisdom of God like King Solomon professed is actually Jesus Christ personified.
6 However, we speak wisdom among those who are mature, yet not the wisdom of this age, nor of the rulers of this age, who are coming to nothing. 7 But we speak the wisdom of God in a mystery, the hidden wisdom which God [j]ordained before the ages for our glory, 8 which none of the rulers of this age knew; for had they known, they would not have crucified the Lord of glory.(1 Corinthian2:6)
But of Him you are in Christ Jesus, who became for us wisdom from God—and righteousness and sanctification and redemption— (1Corinthian2:30)
So the bible is clear all mankind in the Old and New Testament are saved by the Wisdom of God. Jesus became the wisdom of God, but before Jesus the Wisdom of God that saved people in the old testament already exist.
Pope Francis was biblically correct pluralism and diversity of religions are "Willed by God in His Wisdom" because He can save all mankind thru His Wisdom.