The history of the Transvaal is similar to that of the Orange Free State in that both states were formed as the result of the Great Treks of the 1830s and 1840s. The Boer settlers were trying to avoid British jurisdiction in the Cape Colony. They had disagreed over religious rights, slavery and the treatment of black Africans in general. They had originally founded a colony in Natalia but moved on when it was clear that the neighbouring Zulus were too hostile and the British were claiming jurisdiction there too.
The Trekkers moved north and staked out claims on the land between the Orange and Vaal Rivers. Unfortunately for them, there were a number of large and powerful African tribes in the area many of whom had treaty obligations with the British. There were frequent skirmishes and battles between the Boers and the Africans. The British ended up sending yet another force to the area to try and keep the peace on its Cape Colony border between the Boers and Africans. Sir Harry Smith used this as an excuse to add these domains to the British Empire by declaring the Orange River Colony.
Although some of the Boers were relieved to have British protection others had not forgotten why they had undergone the Great Trek in the first place. These hardliners repacked their wagons and headed north eastwards beyond the Vaal River forming the Boer Republic of Transvaal. The costs of policing the Orange River Colony was to proove too expensive for the British who withdrew from that area allowing the Orange Free State to revive again anyway.
Both of these republics were supposed to be god fearing, calvinistic, agricultural societies. They would have been happy to have been left alone except that relations with the surrounding black Africans meant that they were always in a precarious security position.
British interest in the region was revived in the early 1870s when rich diamond mines were discovered in Griqualand West which was an area bordering Transvaal and the Cape Colony. The Transvaal claimed this area based on the Bloemfontein Convention which had stated that the British were not interested in areas north of the Vaal River. The Griqua however were mindful of the poor treatment of blacks and half-castes by the Boers and requested British protection rather than Boer protection. An independent arbiter found in favour of the Griqua over the Boers. In 1871 the British annexed the area and formed it into a Crown Colony two years later. The local chief was then prevailed upon to sell his rights and those of his people for a thousand pounds per year. The Transvaal was understandly incensed by this diplomatic sleight of hand, arguing that Britain had challenged Boer attempts to annex lands whilst annexing it for themselves.
The British would annex Transvaal itself in 1877 as a way of resolving the border dispute between the Boers and the Zulus. This also saved the Transvaal from financial ruin, as the government had completely run out of money. It should also be said that the Zulus did offer a serious threat to the Boer republic and some Boers were happy to gain some support from this hostile foe.
In the 1870s the Zulus were rightfully complaining about Boer encroachments into their lands from the Transvaal colony. A British boundary commission actually found in favour of the Zulu. However the Cape High Commissioner Sir Bartle Frere decided to use this excuse to reduce the Zulu military threat to the entire Southern African region. He said that the disputed land would only be returned if the Zulu army was disbanded. This was too harsh a term for the proudly militaristic Zulu and they ignored the provocative ultimatum.
The British invasion in 1879 from Natal was poorly conceived. The British force was split and the Zulus fell on the main column at Isandlwana with devastating results. The poor deployment and over confidence of the British meant that Natal Colony was virtually undefended. A Zulu Impi did cross the Limpopo River and attacked a British outpost at Rorke's Drift. However, despite the brave defence, this Impi had actually overstepped its orders. Chief Cetsawayo had wisely advised his warriors to fight a defensive war within the borders of Zululand only. They never had any attention of invading any of the white settler colonies, but that did not stop these colonists from being deeply concerned at their security. The British had to respond by sending out an even larger regular army expedition at great expense that defeated the Zulus at the battle of Ulundi.
This eventual crushing of the Zulus was actually a blessing for the Transvaal Boers. They no longer required the support and protection of the British and promptly declared their independence. The British did not know how to respond at first and put up some half hearted resistance to the claims. There was some low level guerilla conflict culminating in the battle of Majuba Hill where British Army units were defeated by superior marksmanship and use of cover. Prime Minister Gladstone quietly withdrew British forces and de facto recognised the Transvaal's independende.
British and Cape politicians would soon regret this withdrawal when enormous gold deposits were discovered in the Transvaal. The discovery of gold would transform the fortunes of all of South Africa, and not always for the best. The Cape Colony politicians would rue their geological misfortune. The premier of Cape Colony, Cecil Rhodes, would go so far as to try and provoke the Boer Republics to try and find an excuse for annexing them. The so called Jamieson Raid of 1895 that was supposed to spark an uprising against the Boer republic failed miserably and caused the resignation of the Cape Premier.
The failure of Rhodes did not mean that powerful forces were not interested in appropriating these huge gold deposits for themselves. Imperialists like Chamberlain and Alfred Milner would make clear their intentions for adding Transvaal and the Orange Free State to the Empire one way or another. By 1899, the Boer Republics concluded that their best chance at avoiding being annexed by the British was to launch a pre-emptive strike into parts of the Cape Colony, Bechuanaland and Natal.
Their initial successes would bring the full force of the British Empire onto the Boer Republics. However the military defeat of the Republics would only mean that the war would move into a longer drawn out guerilla phase of warfare for the next two years. The human and physical costs would be enormous for all involved. A small localised problem became a huge international embarrassment for the British. The determination and skill of the Boers took all by surprise and forced the British Army to seriously question its tactics and approach to modern warfare.
The ultimate consequence of the war would be the Union of South Africa. Paradoxically, for such a long and difficult war, the British awarded surprisingly liberal terms for their foe with the Treaty of Vereeniging. The British would gain formal control of the two Republics but would give considerable rights to the defeated Boers and committed themselves to rebuilding the Boer Republics. 1910, would see this formalised yet further with the Union of South Africa between the Cape Colony, Natal, Transvaal and the Orange Free State.