Even though Emile Durkheim was probably an agnostic, he believed that religion was very important in a society because he believed that religion held societies together. As a social scientist, Durkheim could understand that certain things could have a major impact on other people even if he himself did not believe in them. This ability to see through the eyes of others is vital to a social scientist.
Durkheim was a functionalist. That means that he believed that every institution in a society had to have a reason for existing. Every institution had to help society maintain its stability. Religion is an institution in essentially every society. Therefore, regardless of whether Durkheim believed in religion, he had to believe that it had a role to play in society.
To Durkheim, religion was the most effective way to keep a society unified. If all or most of the people in a society believe in the same religion, it gives them a reason to feel connected to one another. This reason is doubly important to them because they believe that it is a sacred reason, not one that is solely secular or worldly. When people belong to a given religion, they typically engage in religious rituals. These rituals are generally conducted in groups. By participating in these communal rituals, the individuals come to feel even closer to the other members of their society. Again, religion helps to bring people together and make them feel more of a connection to one another.
For these reasons, Durkheim could believe that religion was extremely important even if he was not a believer. He could see that religion could give people a strong reason to feel a connection to one another and he could see that this would help make a society more stable.