Adapted from an earlier answer of mine. The focus is less on the Cuban economic situation (which I'm less familiar with) and more on why the Cuban international missions proved a durable strategy, with a focus on Angola.
From the start, Cuba's military interventions were accompanied by social contributions, also drawing on the experiences of the extensive inner-Cuban literacy and medical campaigns that began shortly after the revolution. F. Castro had spoken out against the perils of illiteracy as early as 1953, and initiated a national literacy campaign in 1961. While official figures have to be treated with caution, we know that the 8-month long campaign was a success, and led to UNESCO declaring the country free of illiteracy. Another point to keep in mind here is Cuba's tactic of international solidarity, which could mean military aid esp. in the 60s' and 70s', but also and increasingly after the fall of the Soviet Union a form of "medical diplomacy". Humanitarian missions were meant to improve Cuba's foreign relations. With the end of the Soviet Union, then Cuba's main economic and military supporter, there was a marked shift from military to humanitarian interventions, with Cuba's foreign troops returning home.
I won't go into detail here because of the 25 years rule, but a few years ago around 35,000 Cubans were still occupied in more than 70 countries in various fields. On the one hand, we have cases of Cuba gaining new allies through emergency aid (as in Honduras), and of medical exchanges connected to economic advantages, as with Venezuelan oil payments. On the other hand, it seems difficult not to see a motivation of solidarity and cooperation at play in these large-scale actions, as with the medical school ELAM which educates international students mostly free of charge, in order to let them use this knowledge in their home countries - also strengthening Cuba's prestige e.g. in Latin America and Africa.
During the campaign in Angola, the Cuban-Angolan cooperation was the basis for the construction of governmental structures and of national education there, employing around 50,000 Cuban civilians until 1991 and thereby strengthening the MPLA's position. I'm going into this Angolan example some more below to show how especially educational aid could function, as well as its limitations - hopefully as a useful parallel to your question on medical aid, which would often (but not always) be used in tandem.
Cuban education in Angola
In a fascinating book on the topic ("Kubaner in Angola: Süd-Süd-Kooperation und Bildungstransfer 1976-1991"), Christine Hatzky talks of "South-South cooperation", highlighting how two non-Western countries worked together in times of the Cold War -- both in order to further their own goals. Turning to Angola: From the early 1960's opposition to the Portuguese colonial regime had started forming. Following the military coup in Portugal 1974, there started the war for independence between various native movements. In 1975 the Angolan MPLA declared independence, backed by the USSR and Cuba. This led to a decades-long civil war with another liberation movement called UNITA until 1991, but continuing afterwards, who had South African (and at some point indirect US) backing.
Already during the conflict for independence, cooperation between Cuba and Angola constituted a main basis for the construction of political structures in post-colonial Angola. The educational cooperation also meant that methods for stabilising rule were brought from Cuba to Angola, serving to strenthen the MPLA's predominance. The construction of a nation-wide public educational system was an important addition to this tactic -- it was made possible through the employment of thousands of Cuban teachers and pedagogues. It was the biggest civil foreign mission of Cuba until 1991, spanning ca. 50.000 civilians in total, and ca. 10.000 active in education.
Both powers followed their own political interests in this educational policy in a relatively equal way, without direct interference by the Cold War powers. On the other hand, the Angolan government often made demands on Havana. Angola had a certain leverage due to their financing of the civilian mission, which was kept secret by Havana even from the civilians themselves. Because of this the mission "based only on solidarity" as propagated by the Cuban government has to be challenged -- we rather see a direct support of the MPLA, from which Havana profited directly. In the end, the commonly proclaimed goals of the creation of a socialist Angola were not realized, as the MPLA started applying stronger capitalist policies from the 80s onwards.
Now for some more details on the educational policies: The Cuban civilans supported administration and control of the territories claimed by the MPLA. However, due to the mission's large scale the indigenous development of an Angolan educational system was strongly disrupted. For one, not enough Angolan teachers were educated.
On the one hand the comparatively innovative pedagogical measures taken by Cuban teachers helped to overcome the colonial educational system. On the other hand this was relativized through internal rules: Thus the teachers' work was only measured by the succesfull holding of exams, not by a sustainable transmission of knowledge. One exemption can be mentioned, the formation of a small but very influential Angolan elite, connected to their education in Angola and in Cuban boarding schools.
Various factors have to be taken into account when talking of a 'failure' of the educational cooperation. First and foremost, it took place during times of civil war, in addition to major South African military interventions. These military conflicts strongly disrupted an literacy campaign (modeled on the Cuban experience). They also meant that many of the Cuban civilians employed in Angola were traumatised by their time in the country -- something not discussed publicly in Cuba until now. The official Cuban discourse rather highlights the military successes esp. after 1991 - including the decisive Cuban assistance during the huge Cuito Canavale battle, which rebuffed South African involvement in the civil war, and is a reason why Cuba was/is seen as an influence on the end of apartheid in independent South Africa..
In truth, the small advances made in Angolan education, infrastructure, administration and medicine due to Cuban civil aid were destroyed since the mid '80s by the opponents of war. Until 1992 the Cuban civilians were gradually recalled. One major consequence for Cuba was the professionalisation and economisation of international solidarity, esp. through the building of administrative structures in Angola but also in Cuba itself -- influencing later Cuban humanitarian missions.
Coming back to your question: at least for the discussed fields of medical and educational aid, these were strongly tied to Cuban advances made after the revolution. Especially the large scale literacy campaign; and the strong focus on medical education and medical campaigns (including vaccinations and cataract surgery) in Cuba. Cuba could then (and still does) build on these advances in order to "export" their expertise as a medical diplomacy - both to gain economic benefits in return, and tied to the ideology of solidarity. These measures have become more important since the fall of the Soviet Union and the end of Soviet military and economic assistance, with such diplomacy providing benefits including oil and allies.
Increasingly by the 80s/early 90s, the military missions were seen as less successful than the non-military aid (excluding Cuito Canavale) - with e.g. Che Guevara's doomed Congo mission in the 60s. I didn't go into more detail so far on the many main cases of Cuban "medical diplomaty" because they mostly fall outside of the 25 years rule, so will just add a bit on those since they seem relevant to the question - they can generally be considered much more successful than the Angolan case. For a few more numbers, since 1960 about 130.000 Cubans have participated in international missions, to places including Guatemala, Pakistan, Bolivia, Indonesia, Beliz, Peru, Mexico, Ecuador, China, El Salvador and Chile for desaster aid. In those 50 years of medical cooperation, more than 85 million patients were treated.
Just to add a more current example, the well-known 'Operacion Milagro' ran in Venezuela from 2005. With the comparatively simple and cheap cataract operations, it's made possible for people to read (again) on a large scale. A different example is the literacy campaign in Bolivia run from 2006 - 2008 with the help of Cuban teachers. Such actions can boost Cuban presitige in these countries in Latin America, but also in Africa and increasingly in Asia, as mentioned above. Just to note that I studied this a few years ago, so there might be changes to these programs under the current government.
Sources:
Hatzky's book was recently translated into English as "Cubans in Angola. South-South Cooperation and Transfer of Knowledge, 1976-1991. University of Wisconsin Press, Madison 2015."
Kumaraswami, Par (ed.), Rethinking the Cuban Revolution Nationally and Regionally: Politics, Culture and Identity, Chichester 2012.
Pérez, Jr., Louis A., Cuba Between Reform and Revolution, Oxford 2010.
--
Edit: Spelling ("literacy")