Anemia is a major cause of morbidity and mortality of pregnant women and increases the risks of fetal and neonatal morbidity and mortality. Approximately 50% of all anemia is estimated to be caused by low dietary intake of iron, poor absorption of dietary iron, or blood loss. The objective of the present study was to determine the prevalence of and assess the dietary habits associated with anemia in pregnant women receiving antenatal care (ANC) in Unguja Island, Tanzania. A cross-sectional study was conducted to select 338 pregnant women at Kivunge, Mwembeladu, and Mnazimmoja hospitals from March to June 2018. Hemoglobin concentration was measured using a HemoCue photometer on capillary blood. Sociodemographic data and dietary habits were collected using a structured questionnaire. Multivariate logistic regression analysis was carried out to determine the predictors of anemia in pregnant women. The overall prevalence of anemia was 80.8%. Of these 68.64% had mild anemia, 11.24% had moderate anemia, and 0.89% had severe anemia. Anemia was significantly associated with inadequate dietary diversity [adjusted OR (AOR): 1.16; 95% CI: 0.57, 2.36; P < 0.05], drinking tea or coffee with a meal (AOR: 0.06; 95% CI: 0.03, 0.13; P < 0.001), consuming <3 meals/d (AOR: 2.92; 95% CI: 1.60, 5.84; P < 0.001), higher education level (AOR: 3.4; 95% CI: 1.6, 7.2; P < 0.0001), birth interval <2 y (AOR: 3.6; 95% CI: 1.1, 11.9; P < 0.05), and multigravida status (AOR: 1.2; 95% CI: 0.3, 4.4; P < 0.0001). The prevalence of anemia in this study demonstrates a severe public health problem among pregnant women. Inadequate dietary diversity coupled with inadequate daily meal intake and consumption of tea or coffee were the dietary habits predicting anemia in pregnant women. Other predictors of anemia were higher education level, multigravida status, and birth interval <2 y. Nutrition policy interventions are needed to complement ANC services by providing important information on healthy eating habits during pregnancy.