The origin of Windows 7's "show desktop" button
Microsoft first experimented with this feature during development of Internet Explorer 4 in 1996 and 1997. It can be observed in a few builds of IE4, IE5, Windows 98 and Windows 2000. I'm not sure whether this was the inspiration for the Windows 7 team, but it's still interesting to see how they came back to this idea a decade later.
If you're old enough to have used Internet Explorer 4 when it came out in late 1997, you probably know it also included something called "Windows Desktop Update". This basically integrated IE and Windows Explorer so the latter could display web content, including on the desktop (called "Active Desktop"), but it also included channels (push technology similar to RSS), folder customization and a few other minor things some Windows 95 users were not particularly fond of. All this was present by default in Windows 98 (and Windows 95 OSR2.5, released the year before), which shipped with IE4, but it was also made available to Windows 95 and NT 4.0 users. Windows 2000 started development around the same time as Windows 98 and was initially also planned to include IE4, but since the development dragged on and on, it ended up shipping with IE5 instead.
One of the early ideas on how to improve the shell was to add a dedicated "show desktop" button on the right side of the taskbar (right of the system time and tray icons, to be specific). This is the exact same spot Microsoft later put the same button in Windows 7. Windows 95 already had a "minimize all windows" option, but it was hidden away in the taskbar context menu, so a dedicated button for this was definitely a handy thing for some users. A related feature, which I'll get back to later on, was the Quick Launch bar on the left side of the taskbar, right next to the Start button. It allowed you to put shortcuts onto the taskbar for launching applications even when you can't see the desktop.
Windows 98 and Internet Explorer 4.0
Development of IE4 started out in early 1996 or so, before even IE3 was completed - early IE4 builds still say "Internet Explorer 3 Beta 1" in the About dialog. Looking at the leaked builds of IE4, it appears the show desktop button was added quite late into development in late 1996, just before the public "Platform Preview" phase. The specific build would be between builds 4.70.1169 and 4.71.0225.1. Don't get confused by the odd version numbers, it's how IE versions before 5.0 were versioned (in typical Microsoft fashion). The button persisted into Platform Preview 1 (builds 4.71.0517.5 and 4.71.0544.0), but was removed by the time the second Platform Preview build 4.71.1008.3 was made. I installed build 4.71.0225.1 on Windows 95 RTM for your viewing pleasure.
The earliest leaked build of Windows to feature a build of IE4 with the show desktop button is Windows 98 build 1400 from 14th February 1997. Previous builds included IE3, whereas in build 1400, the IE version is 4.71.0517.5 (same one I mentioned above). IE4 persisted into builds 1410 and 1411 (version 4.71.0531.0), as well as 1415 (version 4.71.0535.1), along with the show desktop button. Build 1423 reverted back to IE3.02 for whatever reason and so the button was gone. 1434 stuck with IE3.02, but build 1488 from 24th April 1997 included IE4 again (this time version 4.71.0718.1), though without the button. It was never seen again in Windows 98.
Left: IE4 version 4.71.0225.1 in Windows 95 RTM, right: Windows 98 build 1410 with IE4 version 4.71.0531.0
Windows 2000 and Internet Explorer 5.0
On the Windows 2000 side, IE4 version 4.71.0603.0 was already included in the earliest leaked build, 1515.1, from 17th March 1997. The next leaked build was 1575.1 from 11th June 1996, which included IE4 version 4.71.0911.0, but not the show desktop button.
But this is where things get interesting. No build between 1515.1 and 1773.1 (from 18th March 1998) has the button. But meanwhile, build 1729.1 from 6th January 1998 upgrades to a very, very early version of IE5 (5.00.0022.0). The button is still missing, same as in Windows 2000 builds 1743 and 1745 (which indlude IE5 5.00.0202.0 and 5.00.0206.0)), but build 1773 with IE5 5.00.0305.0 has the show desktop button again, with a new icon and even a menu containing some shortcuts to various desktop settings. Build 1796.1 from 30th April 1998 has IE5 version 5.00.0429.0 and still has the button (this time without the menu), and then build 1814.1 from 5th June 1998 with IE5 version 5.00.0518.0 loses the button again. No leaked standalone IE5 build is earlier than 518, so nothing to look into there, unfortunately.
Left: Windows 2000 build 1515.1, right: build 1773.1. The IE5 in build 1773 is so early it still has IE4 branding.
But while the button itself was gone, the "show desktop" feature survived in the form of a default shortcut on the Quick Launch bar I mentioned at the start of this post. It remained there even in Windows Vista. Windows 7 then introduced the superbar which got rid of Quick Launch but brought back the dedicated "show desktop" button. I'm not exactly sure why Microsoft implemented and then removed this feature twice (I personally think it would've been a nice thing to have), but I can guess that making a simple shortcut on the Quick Launch bar is just easier and simpler than having a dedicated button for it.