Do magnets work in outer space? Is there any media where magnet lose its property?
 A: Magnets work perfectly in the vacuum – and in the absence of a gravitational field. They don't depend on any "environment" or "medium". And the electromagnetic force is independent of gravity, too.
In analogy with sound, some 19th century physicists thought that electromagnetic phenomena required a medium called the "luminiferous [=light-carrying] aether" which would play the same role as the "air" for sound. They thought it was a very unusual kind of a material that had to penetrate everything and have other strange properties. That didn't stop them from constructing a mechanical model of the aether out of wheels and gears.
However, it was demonstrated by the Michelson-Morley experiment that there was no aether wind. Also, mostly independently, Einstein's special theory of relativity demonstrated that the "aether" can't be composed of any building blocks that could be "at rest". There isn't any preferred inertial system so there can't be a single aether's system (unlike the case of air that has a preferred frame in which its velocity, the velocity of wind, is zero), either.
From any ambitious point of view, the aether doesn't exist. One may say that the vacuum itself and the fields that always occupy it (including the Higgs field) are a form of the aether except that it is a completely different aether than the luminiferous aether envisioned by the 19th century physicists.
At every point of space and at each moment of time, i.e. for every $(t,x,y,z)$, there exist one electric vector $\vec E$ and one magnetic vector $\vec B$ remembering the field. These fields are inseparable from the vacuum and are responsible for all the electromagnetic phenomena including the electromagnetic waves such as light. According to quantum mechanics, $\vec E$ and $\vec B$ are operators, not just ordinary numbers, that generally don't commute with each other, and that's why the electromagnetic waves' energy comes in packets, the photons.
A: Magnets losing its property means, whether it pauses behaving as a magnet? or it totally loses its magnetism?
There is no medium on the earth where the magnet pauses being magnet. i.e., it wont emit magnetic lines of force. This happens when the surrounding medium relative permeability is zero. (mu=0). From the field equation, the flux emitted is zero what ever may be the strength of the poles. BTW, if there is a medium like that, we cannot see it because as mu=0, the electromagnetic waves wont pass through it.
Magnet losing its magnetism is common everywhere. Heat it, beat it, leave it for itself.
