Guilds were medieval associations of craftsmen or merchants, often holding significant economic and political power within their localities. They regulated trade, maintained quality standards, and protected their members' interests, laying the groundwork for modern trade unions and professional organizations.