If yes, then were there hostilities among the two groups? If not, what were the largest "identities" present on the subcontinent before the Raj?
Since India and Pakistan were both created in 1947, it is obvious that in terms of citizenship, there was no such thing as an Indian or a Pakistani before that date. What did exist, however, were two groups, one campaigning for a single, secular, undivided India while the other clamouring for an independent, Muslim country carved out of the Indian subcontinent's Muslim-majority regions in the northwest and the east. The former are the Indian National Congress, led by Gandhi and Nehru, while the latter are the Muslim League, led by Muhammad Ali Jinnah. The name 'Pakistan' was only coined in 1933 by Chaudhri Rehmat Ali, a young lawyer studying at Cambridge. The term was supposedly an acronym created from the first names of the Muslim-majority regions of India (P-Punjab, A-Afghania (for today's Pushtoons or Pathans who inhabit the northwest of modern Pakistan), K-Kashmir, S-Sindh, and tan-Baluchistan. The I was added later to make the name more pronounceable). It was not adopted by the Muslim League until 1940. The very idea of a separate Muslim state did not appear until 1930, when Muhammad Iqbal, a philosopher-poet who is regarded as the ideological founder of modern Pakistan, presented it in a speech at Allahabad. What this shows you is that the idea of Pakistan is very recent. Just twenty years before independence, it didn't exist. And nor did anything resembling a 'Pakistani' identity. Then what happened? That takes us to the history of communal Muslim political activism in India.
Before the British came, there was no such thing as India as a single nation. The Indian subcontinent was more akin to Europe, in the sense that even though there were important common cultural characteristics, such as the Hindu religion, the primacy of Sanskrit as a language of high culture, writing systems descended from Brahmi, etc., there were also many differences. Just like even though the whole of Europe is (at least culturally) Christian, uses Latin and Greek as languages of high culture and uses Greek-descended modern Greek, Cyrillic and Latin scripts to write its languages, nobody will deny the fact that the French and Italians are two distinct people. India was also, and has throughout history been, extremely fragmented politically, brief periods of unification under
My phone's battery died while I was typing out my answer, and so my answer was cut. I apologise.
the Mauryans, the Guptas, the Delhi Sultanate, and the Mughals. Add to this another layer of separation based on caste, and I'm not talking about just the four varnas but also the thousands of jatis. There were strict rules separating castes. For example, they didn't eat at the same table or drink water from the same well. Most importantly, they didn't intermarry.
So what you have, in brief, is an extremely fragmented society. Some people may have had a vague sense of belonging to a common Indian culture, but everyone identified more with his/her caste, or by the landlord under whose fief his/her village was, than as an Indian. So where do the Muslims come in all of this?
Well, the Muslims have been present in India almost since the inception of the religion itself. As for political power, the Muslims have been a force since 712, when the 17 year old Umayyad general called Muhammad ibn Qasim conquered the area of modern-day Sindh. Subsequent waves of Muslim invaders hailed from Central Asia and conquered the northwest, later expanding all over India. But there was no such thing as a common 'Islamic' identity binding them. While they did sometimes use jihad as an excuse to rally their soldiers, they were also more than willing to fight and kill fellow Muslims and use local Hindu allied to do so. Basically, they wanted riches and land to rule over like all other invaders. Islam was merely an excuse, and then only occasionally. Thus, Muslim rulers merely added to the confusion that pre-modern India already was. Muslim kingdoms appeared, fought, allied, enlarged themselves and broke apart exactly like their fellow Hindu-ruled kingdoms. Thus, there was really no explicitly religious conflict between Hindus and Muslims. If religion was a factor, it was an excuse for something else. But here we've been talking about the ruling class. What about the common people? If anything, the commoners were even less concerned about Hinduism and Islam. Your average Indian at the time, both Muslim and Hindu, was likely to be an illiterate peasant more concerned with survival than doctrinal squabbles. Ordinary Muslims practised a highly syncretic form of Islam, heavily influenced by Hinduism and local rituals. Just like their Hindu brethren, ordinary Muslims would've been more concerned about caste than religion.
Enter the British. The British appeared on the scene in the mid-18th century and soon managed to exert control over the whole of the modern Indian subcontinent, owing to their superior military technology and organisation. For the first time, the modern political entity called India was created. Now, the British were a people alien to the Indians, who had come from very far away and had a very different culture. They also preferred to keep to themselves. Thus, there was an obvious distinction between these foreigners and the natives. The 19th century was also the period when nationalism as an ideology was first developed. All of this caused certain Westernised Indians to begin thinking of themselves as 'Indians' for the first time. This led to the creation of the Indian National Congress in 1885.
Now, the most modernised parts of India at this time were also those which the British had first colonised. These were the 'Presidency' cities of Bombay, Madras and Calcutta, with the last being the capital of British India until 1911. In these areas, the British had established universities modelled on their own. Even today, these are the most prestigious institutes in India. From these universities arose a class of Western-educated natives who soon became the dominant voice speaking for native Indians. Rabindranath Tagore, Raja Ram Mohan Roy, J. C. Bose, S. N. Bose, etc. all belonged to this class.
The only problem? Because these areas were almost entirely Hindu, this class was Hindu too. Enter Syed Ahmed Khan. This fellow was a descendant of the old Muslim aristocracy supplanted by the British. He, unlike other members of this group, also had the advantage of a good Western education. By supporting the British during the 1857 mutiny, he had gained some supporters in the government. He used his unique position as someone whom both Muslims and the British listened to for promoting Western education amongst Indian Muslims. His efforts eventually led to the formation of Aligarh Muslim University, modelled after Oxbridge, in 1921. On the other hand he, being a member of the old Muslim elite, was afraid of his class losing its hereditary privileges in a democratic, Hindu-majority India. So he vehemently opposed any measure to give self-government to the Indians. His excuse was that the Hindu majority would trample the Muslim minority, even though there was no evidence of anything like that. While he never went as far as advocating for a separate state, he did argue for special protections for Muslims. Thus, communal Muslim politics may be said to have begun under him.
Meanwhile, the Indian National Congress (INC) had been steadily changing from a party of Westernised pro-British moderates to one more dominated by radicals like Bal Gangadhar Tilak. In 1905, the British partitioned Bengal into Eastern and Western halves. While the measure was for improving administrative efficiency, it was widely seen as an attempt to divide and rule, as West Bengal was majority Hindu while the East was majority Muslim. In response, the Swadeshi movement, an anti-British movement, began. This was a significantly more violent and aggressive affair than anything before while also being more organised. The British eventually relented and reversed the order while also shifting the capital to Delhi in 1911.
During this time, the small Muslim intelligentsia had also decided to politically organise. In 1906, the All- India Muslim League was formed. Unlike the Congress at this time but like the early Congress, it was a pro-British moderate party, even though it asked for, and got, separate electorates for Muslims in the 1909 Indian Councils Act, thus setting another milestone on the path to Muslim-Hindu communalism.
After WW1, the Muslim League also became a more radical party like the Congress, but the gulf between the two continued to widen. From about 1920 onwards, it was a smooth ride downhill, with the frequency of communal riots increasing, along with the formation of explicitly religious parties on both sides. The Muslim League hardened in its attitudes and refused to compromise with the Congress despite several British attempts to resolve the lockdown, such as the Round Table Conferences and the Communal Award. Meanwhile, a steady stream of reforms (the 1921 Montford reforms, the 1927 Simon Commission, and the 1935 Government of India Act) continually increased the number and power of Indians in the government. In each case, the British gave in to Muslim League demands and so solidified its brand of communitarian politics.
The year 1939 rolled around, and Hitler started WW2. India, as part of the British Empire, was obligated to support the British war effort. Some 2.5 million servicemen (including my grandfather, who illegally enlisted at 16) eventually served. At this point, the Congress badly miscalculated by opposing the war effort and starting the Quit India Movement in 1942. The British response was swift and the Congress leadership ended behind bars for the rest of the war. Jinnah, who by this time had become leader of the Muslim League, quickly took advantage of the situation by improving his party's organization to increase its vote. (The party had been utterly trounced in the 1937 elections). In the 1946 election, his work showed itself- the Muslim League win 87% of the Muslim vote, along with all 30 Muslim seats in the Central legislature and 446/495 seats in the provincial legislatures. The British and the Congress now had no choice but to obey whatever he demanded. He demanded a separate Muslim country called Pakistan, and he was given that in 1947.
Partition was a bloody affair, with 15 million people of the 'wrong' religion being forced to move across the border in both directions as communal riots broke out. 1 million died in the process. Countless others were raped and looted. With such a beginning, good relations between the two new countries were impossible. In 1948 came the Kashmir issue, and the rest, as they say, is history.
Today's Pakistanis exhibit what might be called 'affective' nationalism, which means that they are more motivated by hatred of India than love for their own country. Pakistan has always been extremely unstable, with different ethnic and sectarian groups fighting each other. One of these cases led to the independence of Bangladesh in 1971. Further disintegration has been prevented only by the all-powerful army, aided by China and the US, which promotes Islamic extremism along with anti-India sentiment to hold the country together.