When you write down the electronic configuration of bromine and sodium, you get this
Na:
Br:
So here we the know the valence electrons for each;
Na: (2e)
Br: (7e, you don't count for the d orbitals)
Then, once you know this, you can deduce how many bonds each can do and you discover that bromine can do one bond since he has one electron missing in his p orbital, but that weirdly, since the s orbital of sodium is full and thus, should not make any bond.
However, it is possible for sodium to come in an excited state in wich he will have sent one of its electrons on an higher shell to have this valence configuration:
where here now it has two lonely valence electrons, one on the s and the other on the p, so that it can do a total of two bonds.That's why bromine and sodium can form