It depends on the number of messages, as well as the specifics of a particular device.
The basic rule is: if you notice the app's UI getting sluggish (e.g. a message list taking a long time to open, that sort of thing), then compacting the database might help.
I see the need for this on my (one and only) phone with Android 2.3, about once a month... I don't use it much, but it still receives and trims messages in 3 or 4 accounts. On all the other phones and tablets, running 4.1 - 4.4, I haven't needed this, but of course that's just my experience.
Now, I'm quite puzzled about why this would be needed -- with flash storage, which should have near zero access time, maybe it's the IO controllers / data busses / file system... in other words, again, the specifics of a particular hardware platform and its Android version. Back to square one
