It is hard to believe that the small example you posted compiles to two pages.
However, the caption may very well make the contents of the
{figure}
environment too big for the remaining space. And then the floating property of the
{figure}
environment shows its effect.
The
{figure}
environment (like the
{table}
) is a
floating environment. It is used to
allow its contents to be moved to a place where it fits best.
By saying
[!h]
you
only allow the float to be placed
here. That is – not quite:
h
means
place here if it fits. As this very often isn't the case LaTeX will very likely change this into
ht
and then place the float in the top area (
t
) of the next page. In the small example the bang is completely irrelevant (IIRC it only comes into effect if several floats are to be placed).
Frank Mittelbach has written a detailed explanation on how the floating mechanism works and how it can be influenced.
If you
don't want your figure to float then there are easier ways than
[!h]
(which doesn't prevent floating, anyway)