Let us assume you own a domain, example.com. Postfix / dovecot is the typical setup, to setup the domain: dovecot implements mailbox storage and does POP/IMAP(s) communication with the users email program.
Postfix on the other hand handles the communication with other mailservers, which means postfix is accepting the connection from foreign mailservers if someone sends an email to you, and it is opening the communication to the correct mailserver when you send an email from your example.com domain.
Up until now, no “foreign” domain comes into play. Let us further assume, that you own an email-account like “email@example.com” . You do not want to configure a seperate email account in your email client, but you want to read all mail addressed at the yahoo address inside your example.com mailbox.
That is exactly where fetchmail and getmail comes into play: They connect to a foreign mailbox via POP/IMAP, and saves all mail from the foreign inbox into your local dovecot, in order for you having only connect to your personal inbox.