Trash
If it's sitting in your Trash, yes, mail is automatically deleted at an occasional interval. You can also completely delete it yourself, by clicking "Empty" beside your Trash.
After messages are emptied from Trash, they're permanently deleted from the Yahoo! Mail server and can't be recovered.
Spam
You can choose how long you want to keep messages in your Spam folder. You can choose to immediately delete upon receipt or keep messages for one week, two weeks, or one month. The default setting is one month.
To edit this feature:
Other Folders
Mail in your Inbox and in all your other folders stays in your account as long as you want it to!