First, I think you need an article before "understanding": It is important to have an understanding ....
I do not understand the "in the religion" context. I believe the most clear phrase would be "an understanding of the religion."
By using "the religion" instead of simply "religion" I must assume you wish to specify a particular cult or sect. Because I could say, "Even for an atheist, it is important to have an undestanding of religion" - meaning of the whole concept of religious faith.
However, if you were speaking of one specific religion, you would use "the religion" as in this example: "Before one converts to Catholocism, it is important to have an understanding of the religion."
Student or Learner