It comes from 2 John and 3 John:
"I rejoice very much because I have found certain ones of your children walking in the truth, just as we received commandment from the Father." - 2 John 4
"For I rejoiced very much when brothers came and bore witness to the truth you hold, just as you go on walking in the truth. 4 No greater cause for thankfulness do I have than these things, that I should be hearing that my children go on walking in the truth." - 3 John 3,4
But I believe that the expression "the truth" as used in second and third John are actually titles referring to christ, and is inspired by Jesus' words at John 14:6 where he said:
"I am the way and the truth and the life".
So the expression "the truth" is actually a reference to christ. Thus 2 John 4 and 3 John 3,4 can be mentally read as follows:
"I rejoice very much because I have found certain ones of your children walking in the christ, just as we received commandment from the Father." - 2 John 4
"For I rejoiced very much when brothers came and bore witness to the christ you hold, just as you go on walking in the christ. 4 No greater cause for thankfulness do I have than these things, that I should be hearing that my children go on walking in the christ." - 3 John 3,4
This idea of christians being "in christ" is expressed elsewhere in John's epistles and at John 15:4-7 where the NWT renders Jesus' statement to remain "in me" as "in [union with] me".
So "the truth" is really a metaphoric synonym for the christ. In turn, being a christian is sometimes referred to in the scriptures as being "in christ". Thus, with time, it came to be known as being "in the truth". Interestingly, Jesus also calls himself "the way" at John 14:6, and guess what - the book of Acts refers to early christianity as "the way". So early christians adopted Jesus' descriptions of himself at John 14:6 as alternative ways of saying that they're "in christ". First they used "the way", then they used "the truth". I suppose next they'll be using "the life".
JWs and other groups are essentially copying what the writer of 2 John and 3 John did by using the expression to refer to their religion. So I think there is genuine scriptural basis for christians referring to christianity as "the truth". But given that the expression seems to have originated from Jesus' own designation of himself it seems rather, should I say sacrilegous?, that the JWs apply that term to their religion when they try hard to minimize the role of Jesus in their everyday life and worship.