Fetal electrocardiogram (FECG) contains crucial information about the fetus during pregnancy, making the extraction of FECG signal essential for monitoring fetal health. However, extracting FECG signal from abdominal electrocardiogram (AECG) poses several challenges: (1) FECG signal is often contaminated by noise, and (2) FECG signal is frequently overshadowed by high-amplitude maternal electrocardiogram (MECG). To address these issues and enhance the accuracy of signal extraction, this paper proposes an improved Cycle Generative Adversarial Networks (CycleGAN) with integrated contrastive learning for FECG signal extraction. The model introduces a dual-attention mechanism in the generator of the generative adversarial network, incorporating amulti-head self-attention(MSA) module and achannel-wise self-attention (CSA) module to enhance the quality of generated signals. Additionally, a contrastive triplet loss is integrated into the CycleGAN loss function, optimizing training to increase the similarity between the extracted FECG signal and the scalp fetal electrocardiogram. The proposed method is evaluated using the ADFECG dataset and the PCDB dataset both from the Physionet. In terms of signal extraction quality, Mean Squared Error is reduced to 0.036, Mean Absolute Error (MAE) to 0.009, and Pearson Correlation Coefficient reaches 0.924. When validating the model performance, Structural Similarity Index achieves 95.54%, Peak Signal-to-Noise Ratio (PSNR) reaches 38.87dB, and R-squared (R2) attains 95.12%. Furthermore, the positive predictive value (PPV), sensitivity (SEN) and F1-score for QRS wave cluster detection on the ADFECG dataset also reached 99.56%, 99.43% and 99.50%, respectively. On the PCDB dataset, the positive predictive value (PPV), sensitivity (SEN) and F1-score for QRS wave cluster detection also reached 98.24%, 98.60% and 98.42%, respectively. All of them are higher than other methods. Therefore, the proposed model has important applications in effective monitoring of fetal health during pregnancy.