I'm asking as a relative novice, but have come across the debate in the field of information architecture and classification (and technology studies too). In this field, Aristotle is often quoted as believing in an overarching, objective classification of knowledge and is set against Foucault who (in my understanding) espouses a more subjective, contingent approach to knowledge. In the latter, would it be fair to say that epistemology and ontology are tightly bound up, whereas in the former they are separate? How does this relate to externalism and internalism?
In general, epistemology and ontology are distinct branches of study.
Take a specific debate like the debate about the existence of numbers.
The epistemological question is: How do we know there are numbers?
The ontological question is: Are there numbers?
Now, the two might be closely related. In order to answer the ontological question you must have beliefs about numbers, perhaps these beliefs constitute knowledge (if your beliefs are true, at least).
The two questions are, however, distinct.
A particular thinker (Foucault, for instance, though I don't know much about his thought) might be more concerned with the epistemological question. He might think that is the important one.
Also, ontology is a branch of metaphysics and metaphysics has sometimes been viewed with suspicion (by the logical positivists for instance, who thought all metaphysical questions were meaningless or unanswerable). This sort of attitude might lead one to think that the ontological question is unworthy of attention or somehow parasitic upon the epistemological question (or some other question entirely).
As to your question about Internalism vs. Externalism, there is no clear link between a stance on that epistemological debate and whether epistemology and ontology are importantly related.
In the latter, would it be fair to say that epistemology and ontology are tightly bound up, whereas in the former they are separate?
this is a great observation, but the answer i'm afraid would be no. Foucault aimed to describe how the forms of knowing produced by institutions (medical, psychiatric, penal etc.) relate to the production of subjectivity. So forms of knowing, into which people are born, produce ways of being and structure the way they relate themselves to themselves. I agree this does sound somewhat like a coupling of epistemology and ontology, but Foucault was always fairly aloof in aligning his work with particular branches of philosophy, and did not attempt a systematic ontology.
How does this relate to externalism and internalism?
In essence, metaphysics is always assumed from the first. By this I mean that a tradition is built either explicitly or implicitly on certain metaphysical assumptions or set of axioms, such as materialism/primacy of existence verses say dualism/primacy of consciousness or supernaturalism.
Ontology is then a subset of the metaphysical universe and derived through the applicable epistemology. That is to say, for example, the scientific method is an epistemic process which is employed to derive a scientific ontology.
The metaphysics in this tradition is materialistic, the method is epistemology and the results are ontology. The only question then remaining is; is the epistemology consistent with the stated metaphysics when reaching ontological conclusions?