Can I just swap the hard drives of two macbook pros (different years)?
Solution 1:
Yes. In almost all cases, OS X software is hardware-agnostic (as long as the hardware comes from Apple).
Solution 2:
Yes, as long as both machines have Intel processors in them then both hard disks are formatted with GUID partitioning. If one of the machines was older and had a Power PC processor in it then you'd need to reformat and partition that drive for the newer processor and partition scheme. In your case, swap away.
Solution 3:
It would be best to check with Apple on both serial numbers. They can tell you if the part number for each drive is the same or whether the firmware on each drive is 100% correct for both models. Of course, most SATA drives are fine in any mac for general use, but you can get slowness or less than optimal speeds or sleep/wake issues if the firmware on the system and the drive are at odds with each other.