The reaction of barium and nitrogen will result in the formation of barium nitride.
Here is the reaction...
The barium atoms will lose 2 electrons and form ions with a +2 charge. The nitrogen atoms gain three electrons forming ions with a -3 charge.
The compound must form with a 3:2 ratio to produce a compound which is electrically neutral (no overall charge).
This video illustrates the transfer of electrons that takes place in reactions that form ionic compounds.
Hope this helps!