Can a CT scan detect pregnancy when having a CT scan for appendix? How early cam it detect a pregnancy?

Shouldn't be used. Nearly all facilities will test for pregnancy with a blood test prior to performing a ct scan on a women of childbearing age due to potentially harmful radiation effects to a developing embryo or fetus. Whether they told you or not they probably checked at the time you were evaluated for appendicitis. It is rare to see a fetus on a ct scan because of this, but sometimes is seen in emergency scan.
Inappropriate test. Ionizing radiation will cause damage to dna and fetal tissue and children are most susceptible to the damage. There are many options to confirm or evaluate for pregnancy - most commonly a urine test, and fetal viability can be evaluated with ultrasound.