Hadith: Woman Is Awrah (Tirmidhi 1173)
This is to advise the women to be properly dressed up when they go out as there might be some mischievous people who might be staring at them. It is not about discouraging them not to going out of their houses, as there is no directive in the Quran or hadith that restricts women in houses.