The Just So Stories began as bedtime stories told to ‘Effie’; when the first three were published in a children’s magazine, a year before her death, Kipling explained:More at the Oxford University Press Blog.
. . . in the evening there were stories meant to put Effie to sleep, and you were not allowed to alter those by one single little word. They had to be told just so; or Effie would wake up and put back the missing sentence. So at last they came to be like charms, all three of them,—the whale tale, the camel tale, and the rhinoceros tale.These are stories of origins: ‘How the Whale got his Throat’, ‘How the Camel got his Hump’, ‘How the Rhinoceros got his Skin’—stories that answer the kinds of question children ask, in ways that satisfy their taste for primitive and poetic justice. After Effie’s death, Kipling added nine others, so the number published in the first edition was twelve—a magic number, as everyone knows.