The regiment was raised during the upheaval of the Indian Mutiny, at Rawalpindi on 19 June 1857, as the Regiment of Rawalpindi. In 1860, it was sent to China to fight in the Second Anglo-China War. In 1861, the regiment was permitted to use the Royal Cypher within the Garter on its appointments for its meritorious services. During the Second Afghan War of 1878–80, as part of the Peshawar Valley Field Force, it advanced into the Khyber Pass to clear Afghan forces at Ali Masjid. In 1885, the regiment participated in the Third Burma War. In 1901, the 27th Punjab Infantry was dispatched to British Somaliland to suppress the resistance movement led by Diiriye Guure of the Dervish State.