As people of Mecca at that time were involved in many sinful activities, like they killed their daughters, did drinking, rape, and killing of innocent people, Prophet Muhammad PBUH did not admired those activities at all and to have solitude and peace he went to cave Hira.