Restoring/Forwarding offline emails from Mac Mail
Add your Yahoo! email as IMAP and upload your mail manually from the old —presumably POP— storage on your Mail.app.

I haven't tried it myself but in recent OS X versions adding accounts is straightforward. If this is not the case and you have to configure it manually, Yahoo! offers relevant information to that effect here.