Before the cell divides, it replicates its DNA, so that each chromosome is duplicated to form two identical chromatids. These chromatids are attached to spindle fibers, which are responsible for separating them during cell division.
When the cell divides, each of the two daughter cells receives the same number of chromosomes as the parent cell, ensuring that the chromosome number is maintained.