Rafn was born in Viborg, Denmark as the son of a judge. He began studies of medicine and botany at the University of Copenhagen in 1788, but later changed to veterinary science with P.C. Abildgaard at the Veterinary School in Copenhagen.[1] He never took any final exam, however.