The novel says that a "hanger-on" in the Tattaglia family witnessed Sonny beating up Carlo for beating Connie the first time. He reported it to his higher-ups, which set the entire betrayal in motion. The first time was Carlo being violent with his wife. The second time was Carlo in the pay of Tattaglia and Barzini.
It doesn't take much imagination to see what happened:

Carlo, unhappy in his marriage and in his position in the family. He beats Connie (a crime of "passion" ). Tattaglia guy, a bettor in Carlo's storefront, witnesses Sonny retaliating against Carlo. He reports it. Higher-ups correctly assume that a) Carlo has a grudge against Sonny for beating him up in public; b) Sonny, already famous for his uncontrollable temper, has already thrown caution to the wind in charging down on Carlo on a public street during the height of the Five Families War of 1946--and will likely do it again with similar provocation; c) therefore, contact Carlo and get him to beat up Connie again--this time when Tattaglia and Barzini have set up their guys to ambush Sonny on his way to "rescue" Connie or mete out "justice" to Carlo.


Ntra la porta tua lu sangu � sparsu,
E nun me mporta si ce muoru accisu...
E s'iddu muoru e vaju mparadisu
Si nun ce truovo a ttia, mancu ce trasu.