Sayyiduna Anas bin Malik (may Allah be pleased with him) reports: The Messenger of Allah (peace and blessings be upon him) said regarding a pregnant woman: "If her life is in danger, she may break her fast." And regarding a nursing woman, he said: "If she fears for her child, she too may break her fast."
Related hadith on this topic