"domesticated or tamed animal kept as a favorite," 1530s, originally in Scottish and northern England dialect (and exclusively so until mid-18c.), a word of unknown origin. Sense of "indulged or favorite child" (c. 1500) is recorded slightly earlier than that of "animal kept as a favorite" (1530s), but the latter may be the primary meaning. Probably associated with or influenced by petty.
Know nature's children all divide her care;
The fur that warms a monarch warm'd a bear.
While man exclaims, 'See all things for my use!'
'See man for mine!' replies a pamper'd goose:
[Alexander Pope, "Essay on Man"]
It is an amiable part of human nature, that we should love our animals; it is even better to love them to the point of folly, than not to love them at all. [Stevie Smith, "Cats in Colour," 1959]
In early use typically a lamb brought up by hand (compare cade); but the earliest surviving reference lists "Parroquets, monkeys, peacocks, swans, &c., &c." As a term of endearment by 1849. Teacher's pet as a derogatory term for a teacher's favorite pupil is attested from 1890. Pet-shop "shop selling animals to be kept as pets" is from 1928.