Barracks train infantry over time more rapidly than recruiting offices, for 1000 grain and 500£ per day.
Barracks are a more elite form of Recruitment Offices, but they come with a price - their 1000 grain consumption per day (40/h) can make them inaccessible for many nations. However, there is little advantage to having your grain production significantly above 0 (unless you want to trade it), so you may want to put up a few barracks even with some of the more food-starved nations.
Double-resource provinces also produce twice as many men in the same amount of time, so putting barracks there is generally ideal.
Upgrading the Barracks to level 2 will double the consumption and train bonus (from 50% bonus to 100% bonus). However, bewareat 1/4 or 1/2 completion, a "Level 2" barracks will cost the full 2000 grain/1000£ per day but only boost production of infantry by 75%, so leaving incomplete level 2 barracks is not a very good idea.