Is it unethical to take a photograph of my question sheets from a sit-down exam I've just finished if I am not allowed to take them home? Last semester I've retaken a course and went through the exam. It was a sit-down exam and all students were present. All students are required put their possessions (phones, cameras, etc.) in their bags and put their bags in front of the room.

The students were not allowed to take the question sheets home.

As I was retaking the course, I feel the need to take a documentation to review my answers and to understand the problems better. So AFTER the exam was finished, I take my bag, grab my camera, and then I asked the supervisor (as the lecturer was not present at the site) whether I was allowed to take a photograph or not while gesturing to show my camera (which I had just taken out of my bag). It was denied and I complied without complaining.

Then I told my friend about that incident. He was quite surprised that I complied with that. He told me that he would take the photograph anyway for his advancement in learning, which he said it would be for the greater good but I can't actually spread / redistribute them as it would break the concept of exam itself.

The usual practice in my campus is that if the question sheets are allowed to be taken home, some students would scan and put them into a compilation and share them to the younger students to study and ponder upon as they will get different sets of questions.

Other than that, students that absent at the exam can take it at a different appointed time with a different set of questions.

So I'm stumped whether I should have taken the photograph or not. I thought it was unethical to take it if taking the sheet home is prohibited, but then my friends thought made me reconsider. If I took the photograph I would not create an unfair advantage for those who took the exam at a different date (if there are any) anyway.

PS: I'm sorry if I attracted heated discussions. And I think there is a misconception here. I don't intend to question the rule itself or trying to deceive myself. I only want to know how ethics and etiquette work as I was quite an anti-social from my childhood and I want to start learning about social life. I also didn't intend to redistribute the photograph at that moment.

PS2: My campus was located in Indonesia. I hope this will help to consider the problem at hand

PS3:
The rule was actually enforced by the Department. It would also be enforced to graduate students (and to postgraduate students IF they have any sit-down exams) . My friend which I mentioned above was in fact a graduate student. 

The guidelines mentioned not to ask "Undergraduate-specific issues that could not apply to graduate or post-graduate academicians". As this question is also applicable to (at least) graduate students, I think this question is quite appropriate for Academia SE. But if it's still deemed as an inappropriate question by many and was closed because of it, then I'll just accept the closure.
Taking a photo is effectively equivalent to taking the question sheet home.

For either of these: it’s not inherently a bad thing, and (as your friend said) it can be good for personal study, and so on.  However, it can be used for unethical purposes (passing the questions on to students who haven’t taken the exam yet), so the school have prohibited it.  Given this, it is unethical, since it’s breaking a rule (and, moreover, a reasonably justified rule).

If the rules happen to be written in such a way that they just prohibit “taking the sheets home” and didn’t mention photos, then taking a photo may be allowed by the rule as written, but it is clearly still violating the intention of the rule.

So yes, the supervisor’s ruling was reasonable, and you were right to comply with it.

Edit.  There is, however, no problem with politely emailing the instructor afterwards and asking if you can get a copy of the exam (or parts of it).  No need to mention ethics or taking photos in the email; just say that you’d be grateful to have a copy for your own studying, if the instructor is willing to share it.  Maybe the instructor will say yes; maybe no; maybe “yes, but not until next week”.  But provided you are polite, and ready to accept a possible refusal, then I don’t think there can be any harm in asking.