Is it possible to have a wealthy country without a middle class? This question could be answered in two different ways. A society with just rich and poor without a middle, or a society where the gap between rich and poor is small enough that a middle may not be a meaningful distinction. Society lacks a middle because the gap between rich and poor is too great, or too small. Both are possible.
The Big Gap
In order to understand how society could become more stratified, we have to understand the origins of the middle class. In medieval Europe at least, the vast majority were illiterate peasant farmers. There was a small middle class, mostly skilled labourers; from merchants to masons, scribes to smiths.
European society was feudal for centuries, and in this system serfdom was standard. Peasants were legally tied to their land. Land was owned by the monarch, who gifted estates to nobles as payment for loyalty.
After the Black Death in the mid 1300s much of the European population had died. Those who survived inherited more land and were better able to negotiate wages. This meant that serfdom became less strict in Western Europe, allowing greater social mobility and a larger middle class.
In the east things went the other way. The death toll from the plague in what would become Russia had been low compared with the Mediterranean, and consequently the social order was unchallenged. This allowed lords to enforce progressively stricter laws which segregated peasants from nobles. Eventually by the late 1500s Russian peasants were both an asset which came with land ownership, were forbidden from leaving their land, and could not move up the social ladder. This resulted in a smaller middle class with minimal social mobility.
Thomas Piketty's 2013 analysis of the history of capitalism (Capital in the Twenty-First Century), from the industrial revolution to modern day, concluded on a simple reality: private wealth grows faster than the economy. Thus, naturally inequality grows over time. The growth in inequality tends towards the stratification of society, but we have to understand what makes society more or less equal economically.
The Small Gap
Over the last century those societies who have seen the greatest improvements in living standards and the greatest decreases in inequality have invested in their citizens by enabling commerce and providing welfare (education, healthcare, unemployment benefits, etc).
Amongst developed nations differences in inequality exist. Some have considerably more (UK, USA, Portugal), and some have considerably less (Sweden, Japan). This is detailed by Richard Wilkinson and Katie Pickett in their 2009 book on inequality, The Spirit Level.
One notable observation is that society can reduce inequality with different strategies. Sweden has a much greater difference in pre-tax incomes, but that difference is moderated by tax and spend. In Japan, which has similar inequality to Sweden, the difference is owed to the fact differences in pre-tax income are lower, as Japanese employers do not pay their bosses in excess of their workers.
If an economy is focused on traditional sorts of primary or secondary labour (extracting resources and manufacturing), instead of tertiary or quaternary labour (services and knowledge), then most people will have working class jobs. This allows you to choose whether workers are paid less or more than average, and consequently whether the middle class is small because working class jobs are plentiful and well paid, or because the economy is stagnant owing to a lack of opportunity.
It's also worth pointing out that GDP per capita may be deceptive, as you could have an exceptionally wealthy elite, ruling over an impoverished majority, and still have a seemingly high GDP per capita if they are sitting on some sort of enormous mineral wealth; gold, oil, etc.