Alimony is that device used by judges (and the parties) to attempt to equalize the living conditions of each of the parties after the marriage has dissolved. The more modern term for alimony is spousal support. It’s the same thing.
It is designed to recognize the fact that one spouse may have given up opportunities in the job marked in order to promote non-monetary objectives of the family. (e.g., “we want our children to be reared by a parent, not a baby-sitter”; or the more crass: “no wife of mine is going to work outside of the home.”) Irrespective of the reasons, the “dependent” spouse should not have to bear the entire cost of not having worked outside of the home in the event that the parties separate. If one party currently earns more than the other, it generally is because the other spouse took care of the responsibilities at home to enable the outside-the-home worker to progress in the job. If such was the case, than the sharing of the wealth to which both parties made sacrifices is appropriate. See Divorce Law Common Misconceptions for more examples.
Alimony may be temporary and rehabilitative, or permanent. Even “permanent” support can be modified or terminated based on a significant change of circumstances in the life of the payor or payee.
In practice, alimony is generally awarded from a husband to a wife, but there is no reason other than societal. (i.e., the husband is usually in the financially advantageous position due in part to choices that tend to conform to traditional societal patterns) why the situation cannot be reversed. Alimony is based upon the relative needs and resources of the parties.