The primary cause of congenital kyphosis is the malformation of vertebrae during embryonic development. This can be due to various factors such as genetic mutations, intrauterine environmental influences, or disruptions in spinal development. These malformations can include incomplete formation of vertebrae (hemivertebrae) or failure of vertebral segmentation.