Shotgun marriage is a serious issue that has recently become increasingly common in society. Some men who impregnate women take responsibility and are willing to marry them, while others run away and shirk their responsibility. While some men are willing to marry women who are already pregnant, the perception still exists in some parts of society that those couples must remarry after the children are born and that the children cannot be traced back to the fathers who acknowledge it. This present study aims to answer the following question: what is the legitimacy of marrying a pregnant woman according to Islamic scholars and Indonesian law in the maslahah method? The results of the study reveal that according to Abu Hanifah and his student Muhammad, it is permissible to marry a pregnant woman if the one who marries her is the man who impregnated her. However, the marriage of a pregnant woman to a man who did not impregnate her is still a matter of debate. According to Abu Hanifah and Muhammad, it is permissible, but the man should not have intercourse with her until the child is born. According to Abu Yusuf and Zafar, it is not permissible to marry a woman who is pregnant as a result of zina (fornication) with another man because it is likened to pregnancy without zina. Imam Malik does not allow the marriage of a pregnant woman because of zina and considers such a marriage to be invalid, and the woman must undergo the iddah (waiting) period. Imam Shafi'i, on the other hand, considers shotgun marriage to be valid, regardless of whether the man who marries her is the one who impregnated her or not, and it is permissible for him to have intercourse with her even though she is pregnant because the presence of the fetus does not invalidate the marriage contract. According to the Hanbali scholars, marrying a pregnant woman is not valid unless two things have been done: she has repented and she has waited out the iddah period. Article 53 of the KHI (Kompilasi Hukum Islam/The Compilation of Islamic Law) states that a woman who is pregnant outside of marriage can be married to the man who impregnated her, and the marriage can be solemnized without waiting for the child to be born. However, the KHI should also add a phrase about a man who marries a pregnant woman who is not the one who impregnated her. This permissibility does not mean condoning zina but rather accommodating the interests of Indonesian society, which is in line with the opinion of Imam Shafi’i.