I like marty cohen's answer above but I am going to extend it a bit. In the beginning there were only the natural counting numbers

1,2,3,4,...

But then we couldn't solve equations like $x+4=4$ so the concept of zero was grasped and slowly adopted. Quick side note, the concept of zero was not trivial at all and in Europe wasn't even fully accepted until after the dark ages. Anyway, after adding zero, our number system is

0,1,2,3,4...

But then we couldn't solve equations like $x+4=2$ so negative integers are added and now our number system is

...,-3,-2,-1,0,1,2,3,4,...

But then we couldn't solve equations like $3x=1$ so then rational number are added so now we have the all numbers which can be written as a ratio of two integers without the denominator being zero. But then we couldn't solve equations like $x^2=2$ and $\cos(x)=0$ so then we added all of the irrationals. This step can be broken into algebraic and transcendental numbers but I am just including both in a single step. Now we have all of the real numbers but now we can't solve equations like $x^2=-1$ so then the imaginary unit $i$ is added to the real numbers preserving all of the old operations like addition, subtraction, multiplication, division, and so on. And just by adding a single number $i$ to the real line gives us the entire complex plane.

Here I do disagree that this is the "end". This is not the end and there are still many "impossible" equations and depending on what you want to solve, how do you "want" the solution to "look", and if the extension will be useful and consistent with the "number system" we have in the past, you can throw in more solutions and keep expanding. An example I can give you is, even with complex numbers, we still cannot solve an equation like $xy-yx=1$ so now we have quaternions (matrices are another number system where "impossible" equations like $AB\neq BA$ hold but quaternions are a direct extension of the complex numbers). The article on wikipedia on quaternions is very nicely written and I would urge you to read at least the history part of it which explains how Hamilton pondered the problem of expanding the complex plane and defining multiplication and division so that it would stay consistent with what we have in the complex plane.

And by the way in case you are interested, after quaternions we do have octonions too.

So to answer your question, yes we can define imaginary numbers for all "impossible" equations but the trick is to try to expand the "old" number system, then to expand it in such a way as to stay consistent with what we have in the "old" number system, and then have the expansion be useful in some way.