does TRIM work for the SSD device or the individual OS?
Neither. It works for an individual mounted filesystem. Your drive is unable to tell by itself which data can be discarded because it knows nothing about filesystems nor other structures (like swap partitions), so it needs support from an OS that understands them.
If two of your OS-es access the same filesystem (not at the same time, of course) and the first one didn't trim, a trim command from the second one will do the job for the entire filesystem because it perceives the whole filesystem including whatever changes the first OS did.
As it's not advisable (nor sometimes possible) to mount the root partition of another OS, each OS should trim at least its own root partition and not rely on another OS to do this instead (even though in some cases it may be technically possible).
Also note you cannot trim a filesystem your (current) OS doesn't understand. A possible exception to this may be a utility that understands a filesystem foreign to the OS and can send trimming commands manually, despite the filesystem not even being mounted. You will probably never need such utility; your first choice should be to trim from an OS that understands a given filesystem natively.
will one OS issuing the TRIM command work for the other OS on the same SSD?
In general: no. Your drive doesn't care which OS trims what part, but, to trim right, an OS needs to tell apart relevant data from expendable; so it needs to understand the filesystem you want to trim. For this reason trimming from one OS in a multiboot setup like yours is not enough. A sane approach is to let each OS trim filesystems it uses exclusively. For filesystems "shared" between OS-es at least one OS should trim it on a regular basis.