You must visit a gynacologist doctor
there might be some infection
Penis get harder only if you feel some sexual appeal.
The hardness is due to the blood circulation in the penis as the penis has no bone it just made from the flesh.
Muslim Believe in that
ALLAH(GOD) is one who created this universe no one is equal to him and Muhammad (SAW) is the last prophet send by ALLAH who spread the islam.
This is the main thing in islam.
Any how you can ask further question to me
Its natural. Don't be afraid.