will RAM from a mid-2011 MacBook Pro work in an early 2011 iMac?
The memory for the MacBook Pro 8,1; 8,2 and 8,3 is the same as for the iMac 12,1 and 12,2.

Just as a point of clarity, the models possible are:

Early 2011 MacBook Pro
Late 2011 MacBook Pro

Mid 2011 iMac
Late 2011 iMac