In the Sunni hadith books, especiallly Bukhari and Muslim, it is mentioned that children should not go out at/after maghrib for fear of shayateen. Among some Sunnis, it is customary to discourage women or children in particular from going out then or at night.
Perhaps this developed in part also due to a practical safety concern (that generally it is less safe outside at night, and in many places, women and children are cautious about going out alone at night). Also in those days they had less lighting.
This idea is not commonly found in the Shi'i tradition, and Shi'is generally do not accept the contents of Bukhari and Muslim as authentic without further investigation. I am not saying that this narration doesn't possibly exist anywhere in Shi'i books, since there are thousands and thousands of Shi'i narrations, but it isn't generally given consideration a religious basis. (Of course, culturally, some Shi'is may discourage some people from going outside for social or safety reasons, but that is different.)
Anyway, the Prophet and Imams went outside at night when it was appropriate to do so.