According to the wikipedia on Bicycle Infantry the first use of the bike in war was in the Boer War. It says
The first known use of the bicycle in combat occurred during the Jameson Raid, in which cyclists carried messages. In the Second Boer War, military cyclists were used primarily as scouts and messengers. One unit patrolled railroad lines on specially constructed tandem bicycles that were fixed to the rails. Several raids were conducted by cycle-mounted infantry on both sides; the most famous unit was the Theron se Verkenningskorps (Theron Reconnaissance Corps) or TVK, a Boer unit led by the scout Daniel Theron, whom British commander Lord Roberts described as "the hardest thorn in the flesh of the British advance." Roberts placed a reward of £1,000 on Theron's head—dead or alive—and dispatched 4,000 soldiers to find and eliminate the TVK.