Testing began in 2002 and was supposed to be issued in 2005, but was recalled for more testing. The XM8's origins begin back in 2004, after the decision to discontinue the XM29 weapon system program, but continue developing it with the OICW Increment programs. The XM8 was designed for OICW Increment One, in which a stand-alone assault rifle would be developed to later be combined with the 20mm grenade launcher of OICW Increment Two. The Army's goal for the XM8 was for a weapon that was cheaper, lighter, easier to maintain, and more effective than the M16 and M4 series of weapons.
Although cancelled indefinitely, The XM8 was a participant in a limited competition against the FN SCAR-L, HK416, and the M4. During the tests, most notably of which was a reliability test in dusty conditions, the XM8 did exceedingly well. However, the results have been ruled invalid because the M4 suffered a difference of 575 malfunctions from an identical test conducted a few months before, indicating the test conditions could not be reproduced. 
Despite not being adopted by the U.S. military, Heckler & Koch decided to market the rifle globally. At some point, Malaysia expressed interest, and by 2007 they stated their interest in buying the prototypes. By 2010, the Royal Malaysian Navy special forces known as PASKAL began using the XM8 Prototypes along with other Heckler & Koch assault rifles including the HK416 and G36.
A major innovation is the new mounting system, called Picatinny Combat Attachment Points or PCAP. The idea of this system is to allow someone to remove an attachment to their weapon, like optics or an IR device, and as long as the attachment wasn't sighted in for another weapon, it could be reattached to the rifle and ready for use, no re-sighting needed. The PCAP mounting system can also be retrofitted with the standard picatinny rail mounting system that has become commonplace on nearly every weapon, military and civilian alike.