I cannot forbear adding to these reasonings an observation, which may, perhaps, be found of some importance. In every system of morality, which I have hitherto met with, I have always remark'd, that the author proceeds for some time in the ordinary way of reasoning, and establishes the being of a God, or makes observations concerning human affairs; when of a sudden I am surpriz'd to find, that instead of the usual copulations of propositions, is, and is not, I meet with no proposition that is not connected with an ought, or an ought not. This change is imperceptible; but is, however, of the last consequence. For as this ought, or ought not, expresses some new relation or affirmation, `tis necessary that it shou'd be observ'd and explain'd; and at the same time that a reason should be given, for what seems altogether inconceivable, how this new relation can be a deduction from others, which are entirely different from it. But as authors do not commonly use this precaution, I shall presume to recommend it to the readers; and am persuaded, that this small attention wou'd subvert all the vulgar systems of morality, and let us see, that the distinction of vice and virtue is not founded merely on the relations of objects, nor is perceiv'd by reason.
This is usually understood to be an argument that 'one cannot infer an ought from an is'. However, that's not what it says at all. So here's a little lesson in how to read Hume (and, indeed, almost any other philosopher).
(1) Look for the conclusions being drawn. We have a tendency to read our own conclusions into arguments; and since the conclusion determines the nature of the argument, this leads to severe misreading. Notice the moral Hume draws from his observation:
I am persuaded, that this small attention wou'd subvert all the vulgar systems of morality, and let us see, that the distinction of vice and virtue is not founded merely on the relations of objects, nor is perceiv'd by reason.
In other words, Hume is really targeting a specific position, one that grounds morality on "the relations of objects" and that thinks moral distinctions can be perceived by reason. 'The vulgar systems of morality' is vague in this passage; we'll come back to it.
(2) Don't assume you understand the words. One of the trickiest sentences in this passage is the one that says:
For as this ought, or ought not, expresses some new relation or affirmation, `tis necessary that it shou'd be observ'd and explain'd; and at the same time that a reason should be given, for what seems altogether inconceivable, how this new relation can be a deduction from others, which are entirely different from it.
What makes it tricky is the word 'deduction'. We think of deduction as an inference. That is one thing that 'deduction' can mean in the early modern period. However, it can also mean an explanation or an account. So we need to proceed carefully and not merely assume that it's the inference that's the problem here. Perhaps Hume is talking about an explanation or description. (There is good reason, in fact, to think that 'X is a deduction from Y' here means 'Y explains X'.)
(3) Determine the textual context of the passage. Treatise 3.1 is devoted to arguing against moral rationalism, i.e., the view that distinctions between vice and virtue are discerned by reason (sound familiar). Hume himself is arguing for an alternative position, moral sentimentalism, which holds that we have a special moral sense for determining vice and virtue.
(4) Determine the historical context of the passage. Two major opponents are in view in this section, Samuel Clarke and William Wollaston, both moral rationalists. Wollaston held that morality is a matter of the significance of our actions; vicious actions are those which are 'acting lies' and virtuous actions are those which exhibit truth. Clarke held that morality is a matter of eternal relations discerned by reason; these eternal relations are relations of fitness or aptness. Much of Hume's critique builds on an earlier critique of the same thinkers by Francis Hutcheson, the other great moral sentimentalist of the day. In both Hume's and Hutcheson's critique, the repeated criticism is that moral rationalisms of all types argue in a circle.
(5) Conclude in light of the information gathered. Hume adds to his circularity charge a recommendation to those who read the moral rationalists. Whenever Hume reads these authors, he notices a pattern in their explanations. They start out by talking about God, human nature, etc., and then at some point switch over to talking about duty, obligation, etc. Hume doesn't criticize inferences from Is to Ought (he makes them himself, as all moral sentimentalists do), but the particular way in which moral rationalists, purporting to explain our moral duties and obligations, actually just gloss over the matter entirely. The problem is not that they conclude Ought from Is but that the connection or relevance of their explanation of morality (the Is) to morality itself (the Ought) is not explained, even though (given their position) they need to provide such an explanation. This is confirmed by Hume's mention of 'vulgar systems of morality', because the vulgar (=popular) justification of morality ends up trying to explain morality by morality: X is virtuous because it is our duty, etc. This is precisely the problem with the moral rationalists, in Hume's view. It's another way in which they tend to beg the question.
This, of course, is all very rough, but it should give the basic idea of how to go about interpreting the passage.