Scientists who have analysed the genetics of 10 pedigree dog breeds believe they now have the answer.
Their research identifies 155 distinct locations in the animals' genetic code that could play a role in giving breeds their distinctive appearances.
In the Shar-pei, the team found differences in a gene known as HAS2 which makes an enzyme known to be important in the production of skin.
"There was probably a mutation that arose in that gene that led to a really wrinkly puppy and a breeder said, 'hey, that looks interesting, I'm going to try to selectively breed this trait and make more of these dogs'," explained Joshua Akey from the Department of Genome Sciences at the University of Washington, Seattle, US.
The pedigree dog has become a fascination - and a remarkably useful research tool - for geneticists.
The domestication of the grey wolf more than 10,000 years ago, and the selective breeding that followed, has resulted in more than 400 breeds - each with a distinctive physique, coat colour and temperament.
The study compared the genetics of 10 pure-bred dog groups
These discrete populations give scientists the opportunity to compare and contrast the genetics of the different groups, making it easier to find the causes of specific traits.
"Man's best friend" is helping scientists locate the faulty genes that cause disease in both dogs and humans, as well giving a useful insight into how evolution works at a molecular level.
Dr Akey and colleagues studied 32 wrinkled and 18 smooth-coated Shar-peis and compared a specific stretch of their DNA with that of other breeds.
The team found four small, but significant, differences in the genetics of the two skin types of the Shar-pei versus the other breeds. These single nucleotide polymorphisms (SNPs), as they are called, were located in the HAS2 gene.
"HAS2 makes hyaluronic acid synthase 2, and it's an enzyme that makes hyaluronic acid, and that's one of the principal constituents of the skin," explained Dr Akey.
"There are rare human cases where there are mutations that lead to really severe wrinkling in humans, too.
"So, that suggested it was a good candidate to look at; and sure enough, when we sequenced it we saw that that gene explained wrinkling in Shar-peis," he told BBC News.
Science explained: What is a genome?
As well as giving insights into the Shar-pei, the research has also identified a raft of other locations in the dog genome that can now be investigated further to understand better why pedigree animals look the way they do.
"The thing that excites me most about our study is that in the last five years, five genes have been identified that contribute to this vast diversity in dog breeds," said Dr Akey.
"So our study found all five of those genes and then we found 150 new targets to explore. It's a powerful approach to look at the genetic legacy of selective breeding."
Dr Akey and colleagues report their findings in the Proceedings of the National Academy of Sciences (PNAS).