Hello and welcome.
It depends on the exact model of the 2012 MBP. If it is a Mid 2012, then it should fit. If it is a Retina, Mid 2012, it won't, as that model's drive is a different form factor (flash storage card). The Late 2008 and Mid 2012 MBPs use a 2.5" size drive enclosure, so it can be swapped. It is a little trickier to replace the drive in a 2012.
Also, the drive interface speeds are different:
Late 2008: 3.0 Gbps Serial ATA (SATA)
Mid 2012: 6.0 Gbps Serial ATA (SATA)
But, that doesn't affect compatibility, only read/write speeds.
-What size is the drive in the Mid 2012?
-What version of OS X/macOS in the 2008?
-Did you install the 500 GB SSD in the 2008 MBP?
-If so, what brand/model is it?
C