We consider the propagation of a stochastic SIR-type epidemic in two connected populations: a relatively small local population of interest which is surrounded by a much larger external population. External infectives can temporarily enter the small population and contribute to the spread of the infection inside this population. The rules for entry of infectives into the small population as well as their length of stay are modeled by a general Markov queueing system. Our main objective is to determine the distribution of the total number of infections within both populations. To do this, the approach we propose consists of deriving a family of martingales for the joint epidemic processes and applying classical stopping time or convergence theorems. The study then focuses on several particular cases where the external infection is described by a linear branching process and the entry of external infectives obeys certain specific rules. Some of the results obtained are illustrated by numerical examples.