The saying implies that you might think you will have excellent relations with your neighbours if there are no fences between your properties and you each come and go as you please. But, in reality, without fences, sooner or later neighbours will get on each other's nerves or will have a dispute over their respective territories. More generally,. the saying means that any community needs laws and rules, in order for people to live together in harmony. (And it manages to say all that and more in 5 words!)