Windows Mail does nothing to the messages when it compacts the message
store.
The message store is a file that keeps track of the messages, which folder
they're in, etc.
When you delete a message, the message store still contains data about it,
but not the message itself.
When you do the compaction, the data about the deleted messages is removed
from the message store, and the space is reclaimed.
It does nothing to the messages.
By default, it does this every 100th shutdown. You can change the frequency
in
Tools -Options - Advanced - Maintenance
I changed mine to 4, as I seldom shutdown the mail program.