well, the imf was set up after bretton woods in 1944 as an institution that would prevent currencies from imploding. it operates in the same general context as the world bank and, regionally, other transnational banks on the other of the interamerican bank.
the reason for it had much to do with the prevailing american understanding of fascism in germany as arising out of the period of hyper-inflation in weimar germany, so with currency collapse.
it was part of the reconfiguration in the infrastructure that supported/stabilized capitalism that was put into place after world war 2--alongside institutions like nato (which was set up both as a cold war alliance and as a guarantor of nation-state stability) seato, etc---and the institutions that administered/benchmarked the marshall plan (oecd)...
when the nixon administration dismantled the bretton woods system, it not only took the dollar off the gold standard but it also provided impetus for the creation of international currency markets which allowed speculation (in general, not necessarily in a pegorative sense) to fix exchange rates. this left the imf without the latitude to operate as it was set up to do---by the early 1980s, it had been transformed into an instrument of american domination in the southern hemisphere primarily, moving into the chaos generated by the way in which colonialism was ended (around 1960--but it's a complicated story which maybe you know about...it's interesting too, but not so relevant here). the idea was apparently still the same--the imf would operate as a lender of last resort with the goal of enabling stabilization of basic parameters and support for transition into the neoliberal world order. i'll pass over that.
since then, it's been a primary generator of crisis in the name of staving off crisis in the south.
of course, that's not what the imf says it does. here's the overview from their website:
What the IMF Does
it's set up with a governing body the composition and voting power of which is determined by the proportions of nation-state funding that gets diverted into it. so it works with monies allocated to it by the consortium of nation-states that are represented on it's board. most of it's income derives from membership quotas:
Factsheet - Where the IMF Gets its Money
the idea behind the imf at its inception was basically that the consequences of allowing national economies to implode far outweighed any conceivable advantage to be had from it---again the american understanding of world war 2, particularly with reference to germany, centered on fascism as a result of economic (and political) instability during the weimar period--which isn't wrong exactly, but it leaves out a whole lot of stuff as well (like the radical nationalism central to fascist ideology)...so it was with that experience in mind (this was put into motion in 1944) the decision was taken collectively that stabilization mechanisms had to be in place.
there's more, but i'll leave it at that for the moment.