Do not read the verses literally. It has to be read in conjunction with how the prophet practised.
This verse is specific to the women in the prophet's household. It reminds them to stay at home, if they have no business outside. And to cover themselves, unlike the previous pagan times when they flaunt their assets, to stave off fitna.
Qur’an 4:34:
Men are in charge of women by [right of] what Allah has given one over the other and what they spend [for maintenance] from their wealth. So righteous women are devoutly obedient, guarding in [the husband’s] absence what Allah would have them guard. But those [wives] from whom you fear arrogance – [first] advise them; [then if they persist], forsake them in bed; and [finally], strike them. But if they obey you [once more], seek no means against them. Indeed, Allah is ever Exalted and Grand.