In the past safety and security may have meant fortifications against other tribes and today gated communities are certainly about safety and protection of assets - although whether people that share a gate feel a sense of community with each other I doubt, but would love to know. There is safety in numbers and close neighbours that know each other and the people that create neighbourhood watches bring people together with the common interest of looking after the population in a particular area they operate in.
To create authentic community where everyone feels safe to be themselves and accepted for who they are is much more difficult and takes time and intention. It means 'no secrets' and 'no judgement'. As humans we naturally make judgments all the time and safety is very easily destroyed if there are any persecutor, victim and rescuer triangles. These roles are common ways we behave that we move between in our different relationships with people depending on the early beliefs we developed, primarily as children. Some peoples upbringings have been tougher than others and they have developed a bullying attitude to survive in that situation. In contrast others have been treated with kid gloves and have not learnt to deal with any conflict. These people in the victim role have not learnt to stand up for themselves and can create situations where they feel disempowered and not included or listened to in the community. The bullies tend to enrol others to be on their side by engaging in gossip and put down. Dysfunction like this in community, is so common that it is accepted as normal, especially if their family was dysfunctional and it feels similar.
There is no community or a feeling of safety where this dynamic exists. Using non-violent communication tools can empower individuals to express their feelings and needs.
A dedication by everyone in the community towards personal growth and regular workshops and tools to assist this evolution is probably the most important single factor in creating a sense of safety between people.
Other practices that enhance the feeling of safety are the regular practice of way of council, daily circles and other factors that lead to regular communication. This may be bump zones and shared facilities that allow you to see the neighbours on a regular basis.