Romania joined the axis primarily as a defence against the Soviet Union and to help preserve their own territorial integrity. The Romanian foreign minister prior to 1936, a many by the name of Nicolae Titulescu, had actually sought to align Romania with France and the Soviet Union against Germany and a resurgent Hungary who had been pressing their territorial claims in Transylvania. While the pact with the Soviet Union was successfully signed, many in Romania were apprehensive about Soviet ambitions in Bessarabia and Bukovina (parts of Northern Romania that would later be given to the Soviets via the Molotov-Ribbentrop pact). Nicolae Titulescu was eventually dismissed in late 1936 by King Carol II of Romania because he, like many others shared reservations about aligning with the Soviet Union.
From three factors led to closer alignment with Germany:
The Munich Agreement
This was important because it demonstrated to Romania that the western powers of Britain and France were unwilling to fight and would thus be unable to effectively aid Romania against the Soviet Union or Hungary, or any other potential enemy.
The takeover of Czechoslovakia by Germany
This event was important for both political reasons and economic reasons. Besides the obvious political ramifications where in Germany became more powerful and further exposed Britain and France as being unwilling to fight. It also marked the end of the "Little Entente" which was the alliance between Czechoslovakia, Yugoslavia, and Romania. While the alliance had been losing its importance for a while, this marked the complete end of it.
In terms of economic reasons it also held great importance. Czechoslovakia's Skoda Arms works was Romania's biggest supplier of weapons, since Germany took over the company, Germany was now Romania's main supplier of arms. King Carol visited Britain and tried to get them to invest in Romania to try and offset Germany's economic dominance in the country, but the British considered it to be economically unsound and the Romanians were forced to gravitate more towards Germany.
A new foreign minister, Grigore Gafencu, was appointed and he led the country into closer economic ties with Germany, including the founding of several German companies dedicated to exploiting Romania's natural resources, most importantly oil.
The Molotov Ribbentrop Pact
Another important event, the signing of the treaty, which contained secret clauses giving the Soviets "influence" over former Russian territories, like Bessarabia. The Romanians did not know of this secret part of the pact, and thus when the Soviets began to posture against Romania for the return of Bessarabia, the Romanians naturally moved even further into Germany's sphere of influence.
Obviously the Germans had already consented to the Soviet annexation of the territory, although the Soviets took a bit more than originally promised by the Germans, namely a territory called Northern Bukovina. King Carol, obviously worried about Soviet ambitions, and realizing that France (completely overrun at this point by German soldiers) couldn't possibly help, declared his country's solidarity with Germany.
Germany forced the Romanians to give territory to both Bulgaria and Hungary, in exchange for German protection of Romania territory. This was quite the diplomatic coup for Hitler, as he had managed to make Romania an essential client state of Germany while also making Bulgaria and Hungary happy.
It was after these events, as well as a general climate of political instability, that led to general Ion Antonescu rising to power as dictator of Romania. King Carol had held dictatorial powers since the mid 20's, and he transferred them to Antonsecu. Shortly after King Carol was forced to resign in favour of his son Michael, eventually Antonescu crushed the rebellious Iron Guard (fascists who had originally support him, but turned to on Antonescu and began a local uprising). And made a favourable impression on Hitler. He signed the tripartite pact in late 1940, a few days after Hungary had signed it. Antonescu was ecstatic at the idea of attacking and the Soviet Union and immediately supported it as soon as Hitler let him know the invasion was going to happen. Antonescu would rule until 1944 when King Michael led another coup and Romania switched sides to the Allies.