Before answering your question, a couple things should be made a little more precise: Roughly speaking, an oracle machine M is one that given an input number n and an oracle (subset of $\mathbb{N}$) X, outputs another natural number $M^X(n)$ (or else fails to halt). The algorithm for computing the output can't depend on the input number n or oracle X - the actual computation that gets done by the machine might of course change if the inputs are changed, but the algorithm dictating the steps of the computation is fixed. Also, the machine/algorithm must be finitistic - at any finite point in time, the machine can only have accessed finitely many bits of the oracle. Once consequence of this is that if M halts on input n with oracle X, and does so after accessing only, say, the 10 first bits of X, then M must halt on input n for any other oracle X' with the same first 10 bits as X, and produce the same output as it did before.

Now, when you say "if an oracle O can solve the halting problem for machine M," that should be interpreted as saying that there is a machine M' such that, given an input number n and finite string $\sigma$, $M'^O(n,\sigma )$ outputs HALT if $M^X(n)$ halts for any oracle X with initial segment $\sigma$, and does so using at most the first length($\sigma$) bits of X; and outputs FAIL otherwise. More simply put, saying that O solves the halting problem for M says there's some machine M' which, upon using O as an oracle, solves the halting problem for M. It doesn't say that you can use the same machine M with O to solve the halting problem for M.

But you generally don't solve the halting problem for a machine, you solve it for an oracle. The halting problem for a set X asks: "Is there an algorithm such that given any machine M and number n, the algorithm decides whether M halts on input n using oracle X?" Since machines are finitistic objects, it makes sense to talk about an algorithm which takes M and n as inputs. It also makes sense to encode M as a finite number [M], and then define X' (read "X jump" or "the halting problem relativized to X") as {(n,[M]) | $M^X(n)$ halts}. Then you say Y computes X' iff there is a machine M such that $M^Y(n,[M'])$ outputs HALT if (n,[M']) is in X', and FAIL otherwise.

You can prove X does not compute X'.