Yes, some states and/or apartments have rules about this, as well as how many people you can have per bedroom (regardless of gender, I believe). Usually it's after 18 months of age, they aren't "allowed' to sleep in the parents bedroom, and that only 2 kids were allowed per room. That has been our experience when we lived in CO, and in several different apartments. If you lie on the lease and omit one of the kids, for example, then you can get in trouble for violating the lease requirements and get kicked out.
I think when you own your own home, you can have the kids sleep/share rooms regardless of age and gender. Maybe only if CPS gets involved do you have to have separate beds, at least? Not sure about this.
Thinking about my older two children (DD, 9; DS, 7) they have their own rooms, but much prefer to sleep in each other's room most nights. They have always been close like that, and maybe it's b/c they had to share a room as toddlers/preschoolers years ago.
eta: it's not just a low-income housing thing, IME, unless that's a hard rule for opposite genders sharing rooms. One townhome we applied for years ago (we had 3 children, with the 4th on the way), said our family was too big for the space - even though there were 3 bedrooms. It may not have been b/c of a law, but they can definitely discriminate based on number of occupants.