Guilds are a way to socialize with other players and take part in weekly competitions. You can also earn some goodies for yourself for your contributions to the guild.
To get started, you'll need a guild building. This can be purchased in the first tab of the shop, and will appear to the left of your farm on a little island in the stream below the bistro area.
Once you have it, you can click on the building to access the guild feature. You can either found your own guild, or ask to join a guild with open spaces from the ranking list.
Every week, there will be a new contest that you can participate in as a guild. This requires members to donate a specified product to the guild (just click on a free slot in the tab with the barn icon to donate products); the leaders of the guild can that submit these items to the contest. When the contest ends, your guild will get guild experience and kudos for each member.
Kudos are a currency you can earn by contributing products and money (both Coins and Diamonds) to the guild. They unlock prizes that you can collect in the tab with the trophy.
Of course, participation in these things is completely optional. Guilds are also just a great way to socialize with other players if you're not particularly competitive.