When agnosticism is discussed in the context of religion, few seem to realize that agnosticism is not only compatible with religion, but can in fact be an integral part of some religions. Instead, people assume agnosticism must stand outside of religion and religious systems, either as a disinterested observer or as an active critic. This may be true of some agnostics and especially of agnostic atheists, but it's not inherently true of all agnostics.
The reason why is fairly simple and, once you understand agnosticism, quite obvious. Agnosticism is in the broadest sense the state of not claiming to know if any gods exist; at most, it's a claim that no one can know if any gods exist or not. Agnosticism might be held for philosophical reasons or not, but whatever the position a state of not knowing does not preclude a state of believing nor does it preclude taking action, two things which characterize most religions.
Agnosticism & Orthodoxy
Some religions are focused on maintaining "right belief," or orthodoxy. You're a member in good standing if you hold the beliefs you're supposed to and not the beliefs you're not supposed to hold. Most of the institutional resources within such a religion are devoted to teaching, explaining, reinforcing, and promoting the "right beliefs" that are the foundation of that religion.
Knowledge and belief are related issues, but they are also nevertheless separate. Thus a person can believe some proposition which they know to be true but also believe another proposition which they don't know to be true — not knowing if something is true or not does not precluding believing that it is true anyway. This obviously allows for a person to be an agnostic while also believing a religion's "right beliefs."
So long as the religion does not demand that people "know" something, they can be agnostic and also members in good standing.
Agnosticism & Orthopraxy
Other religions focus on maintaining "right action," or orthopraxy. You're a member in good standing if you perform the actions you're supposed to and don't perform the actions you're not supposed to. Even religions which focus on "right belief" have at least some elements of orthopraxy, but there are others which make orthopraxy much more central. Ancient religions which are focused on rituals are an example of this — people weren't asked what they believed, they were asked if they made all the right sacrifices in all the right ways.
Knowledge and action are even more separated than knowledge and belief, creating even greater room for a person to be both an agnostic and a member of such a religion. Because a heavy emphasis on "right action" is less common today than it has been in the past, and more religions incorporate greater focus on orthodoxy, this is probably less relevant for most agnostics living today. But it's still something to keep in mind because it is a way in which a person can be agnostic while being a normal part of a religious community.
Knowledge, Belief, and Faith
One final note should be made about the role of "faith" in a religion. Not every religion emphasizes faith, but those which do are opening up greater room for agnosticism than may be intended. Faith, after all, is mutually exclusive from knowledge: if you know something to be true then you can't have faith in it and if you have faith in something you're admitting that you don't know it to be true.
So when religious believers are told that they should have faith that something is true, they are also being implicitly told that they don't need to know that something is true. Indeed, they are being told that they shouldn't even try to come to know that it's true, perhaps because it's impossible. That should necessarily result in agnosticism if the subject happens to be the existence of any gods: if you believe that a god exists but believe because of "faith" and not because of knowledge, then you're an agnostic — specifically, an agnostic theist.