It is important to note that Comte made this claim in the mid-1800s. At that point, it was much more plausible to argue that religion was a source of harmony in society. Today, religion continues to be a source of harmony in some societies, but these societies are not as numerous as they once were.
In general, religion can be a source of harmony in a society when the vast majority of people in the society believe in the same religion. When this is the case, people share common values and experiences. For example, the society may be more harmonious because people all believe in the same things and because they all participate in the same religious festivals and rituals. It was for this reason that Comte wanted to create a secular religion that would allow people to participate in rituals that would bond them even though they were not religious.
Religion can certainly be a source of harmony in society so long as most of the people in the society adhere to the same religion.
Thanks, this is really helpful.