Richard Nichol, 75, of Parkdaill, Hawick, was jailed for nine months at Edinburgh Sheriff Court.
He had previously admitted being in possession of indecent photos of children between January 2011 and January last year.
He was also placed on the sex offenders register for 10 years.
Fiscal Depute Ann MacNeill told Sheriff John Beckett QC at a first hearing that Nichol's daughter had been given the computer by her father after he bought himself a new one.
On checking his computers, the police found a total of 5,198 indecent still images. Ms MacNeill said 1,066 were at level A, the highest level; 953 at B; and 3179 at C, the lowest level.
At that hearing, defence solicitor Robert More told the court that his client was a first offender at the age of 75.
He had, said Mr More, made a "comprehensive and candid admission" at the police interview.
Nichol, he added, had served in the armed forces for 20 years and then spent another 20 years working for a paint supply company and reaching a managerial position.
Referring to the social work report which had been prepared, Mr More said that the personal circumstances of his client were such that the court could be justified in exercising its discretion and not imposing a custodial sentence.
He suggested a restriction of liberty order and community payback order under supervision.
He told Sheriff Beckett that approximately half of the category A images had been computer generated and were not of real children.
If given a custodial sentence, he said his client would be extremely vulnerable.
Sheriff Beckett commented that the same could be said of the children in the real images and that such was the seriousness of the crime there was no alternative to a prison sentence.
A court has heard how a woman reported her father to police after she found an indecent image of a child on a computer he had given her.