Basic aspects of heart morphogenesis involving migration, cell polarization, tissue alignment, and lumen formation may be conserved between Drosophila and humans, but little is known about the mechanisms that orchestrate the assembly of the heart tube in either organism. The extracellular-matrix molecule Slit and its Robo-family receptors are conserved regulators of axonal guidance. Here, we report a novel role of the Drosophila slit, robo, and robo2 genes in heart morphogenesis. Slit and Robo proteins specifically accumulate at the dorsal midline between the bilateral myocardial progenitors forming a linear tube. Manipulation of Slit localization or its overexpression causes disruption in heart tube alignment and assembly, and slit-deficient hearts show disruptions in cell-polarity marker localization within the myocardium. Similar phenotypes are observed when Robo and Robo2 are manipulated. Rescue experiments suggest that Slit is secreted from the myocardial progenitors and that Robo and Robo2 act in myocardial and pericardial cells, respectively. Genetic interactions suggest a cardiac morphogenesis network involving Slit/Robo, cell-polarity proteins, and other membrane-associated proteins. We conclude that Slit and Robo proteins contribute significantly to Drosophila heart morphogenesis by guiding heart cell alignment and adhesion and/or by inhibiting cell mixing between the bilateral compartments of heart cell progenitors and ensuring proper polarity of the myocardial epithelium.