Generally and legally no, since the installer on the DVD is checking for machine specific model identifier for the MacBook Pro that the DVD came with as shown in this workaround .
Once the file is opened, scroll down about ¾ of a page and you will come across a series of strings named hwbeSupportedMachines.
Now, technically the DVD's that came with Macs included a standard Mac OS 10.x.x Install plus new drivers for hardware specific features for that new model, stuff that would not be known about or included in the 10.x retail install DVD Mac OS X versions (builds) for computers. Which means the OS that came with your Macbook Pro once its installed on the Mac Book Pro should include all it needs to run on the iMac too. You just have to get it there, which you could do via cloning a 10.6 install from the MacBook Pro to the iMac or maybe via installing OS X 10.6 on the iMac via the MacBook Pro using FireWire target disk mode.
Untested Solution if you want go the Upgrade path of 10.5 to 10.8 wihout erasing the iMac
Backup important Data on iMac
Boot the iMac into target disk mode, by holding down the T key while boot the iMac.
Connect iMac to the MacBook Pro via FireWire
Boot the MacBook Pro from its 10.6 Installer DVD
Try to select for installation of OS x 10.6 the hard drive with 10.5 installed on it in the iMac.
Note: This is the untested part, the Restore / Install DVD may not allow upgrades from prior OS X versions.
Boot up the iMac and then upgrade to latest version of OS X 10.6
Install OS X 10.8
Recommended Solution:
This will promote better performance via a clean install to a blank disk thus reducein legacy cruft and other left-overs from old OS X installs and old Applications, etc.
First thing upgrade the MacBook Pro to Mountain Lion, if you have not done so already.
Next back up all your files you want from the iMac, since OS X Lion / Mountain Lion will not be able to upgrade users from Mac OS X 10.5 to 10.8.
This is really easy*. But the version of the OS doesn't matter. it's the version of iPhoto that does.
So, if you have iPhoto 6 or earlier:
Go to your Pictures Folder and find the iPhoto Library Folder there
iPhoto 08 or later:
Go to your Pictures Folder and find the iPhoto Library icon there
In either case then drag the iPhoto Library from the Pictures Folder to another Disk. The Disk should be formatted Mac OS Extended (Journaled).
Once that's done test the back up - open it and view the Photos: To choose a Library to open: Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
Assuming the Library is working okay that's the back up part.
Then the restore:
Drag the Library from the External back to the Pictures Folder. Then Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library' and point iPhoto at the Library in Pictures.
Done.
*Easy that is unless you have a referenced Library. A Referenced Library is when iPhoto is NOT copying the files into the iPhoto Library when importing because you made a change at iPhoto -> Preferences -> Advanced. (You unchecked the option to copy files into the Library on import) The files are then stored where ever you put them and not in the Library package. In this scenario you are responsible for the File Management.
IF you have a Referenced Library then you have a much more complex job. You'll need to convert it to a Managed one, and the do the steps above.
Best Answer
As with any major change to an OS I'd recommend taking a backup of the machine before the migration. TimeMachine is the Apple's built in backup software. If your upgrade goes poorly you'll be able to restore from a TimeMachine backup without supplying OS media. To ensure that you have a complete and consistent TimeMachine backup I'd recommend running the backup with all applications closed. Preferably get a few different backups so you have multiple points to roll back to.
Secondly, I'd check the installed third party applications and their compatibility with 10.6, some applications might not support 10.6 and will need to be updated to continue to work. You could install a third party program that will track application that will inform you of application updates. I use, and would recommend, AppFresh for this purpose.