The modern state of Romania appeared on the map in the 19th century as a result of a "personal union" of the principalities of Moldavia and Wallachia under the prince Alexandru Ioan Cuza.
These two countries had an elective monarchic system of Byzantine origin. Under Ottoman suzerainty, their princes were initially, at least theoretically, "elected" by the local elites or even by popular acclaim, and then confirmed by the Sultan, but by the 18th century the formalities were reversed: the Ottoman court selected the prince, who was then formally "acclaimed" by the locals.
After the Napoleonic wars, the two countries fell under Russian influence and even military occupation, the Ottoman rule becoming mostly nominal, limited but still important in relation with the nomination of the price.
Administrative union was promoted by Russia through the establishing in the two countries of the same set of laws (a proto-constitution, Regulamentul Organic) in view of a future annexation.
But Russia's plans of annexing the two countries fell short with the Crimean War.
I have found a clear but exhaustive presentation of the context of this event in Daniel Chirot, Social Change in a Peripheral Society, 1976, p.112-117:
The Crimean War was fought over a number of issues that revolved
around Great Britain's desire to curb Russia's threat to the British
Empire, particularly to its "lifeline" running through the Eastern
Mediterranean. The fate of the Danubian principalities was one of the
important points of the dispute. Romanian grain exports were
becoming increasingly important to Britain, and Wallachian and
Moldavian markets seemed promising to British industry. Both the
French and the British wanted more stable, cooperative regimes in the
principalities. But the most important issue was that both countries
wanted to limit Russian power on the Danube.
... issues had to be settled with respect to the principalities...
should they be united into a single Romanian state? (It was recognized
that they shared a common language and rather similar institutions and
... These questions, it was decided, were to be settled by the seven
interested powers—Great Britain, France, Austria, Turkey, Russia,
Sardinia, and Prussia. The first five of the seven were the most
important parties in the discussions to decide these issues. Sardinia
followed France's lead on every question in order to maintain its
alliance with Napoleon III against Austria; and Prussia was
essentially neutral in the discussions, as well as being more removed
from the issues in which it had no serious interest.
...Great Britain was most interested in the international issues and
felt that no substantial internal changes were necessary in the
principalities. Rather, the British hoped that the principalities
could simply revert to tighter Ottoman control. Austria was more
interested than Britain in the domestic problems of the principalities
because it ruled a large Romanian population in Transylvania and
Bukovina, and because once again it hoped to expand its economic and
political influence down the Danube. But Austria had not participated
in the Crimean War against Russia, choosing instead to remain neutral,
and the only way it could have gained its Danubian ends would have
been to give up northern Italy in return. This latter solution,
proposed by Napoleon III, was rejected by Austria.
Russia had lost the war and therefore resigned itself to losing its
hegemony over the principalities. In an astonishing reversal of its
policy, Russia began to support the nationalist liberals in Romania on
the question of national unification. This was for the double purpose
of annoying the Austrians and of gaining popular support within the
principalities. A further consideration in Russia's new position was
its desire to gain a friend among the victorious Crimean powers, and
Napoleon III had a vague ideological commitment to the Romanian
nationalists. The Ottoman Empire simply wanted to regain some of its
lost influence in the principalities in order to block future Russian
expansion toward Constantinople.
...A related issue... was whether or not the principalities should be
ruled by native or foreign (i.e., Western European) princes. The
diplomatic haggling that went on at the various post-Crimean War
conferences would have been comical, if the fates of millions of
Eastern Europeans had not been decided by considerations of the
balance of power between the major powers...
...The main issues, both international and internal, were still not
settled by 1858, so another conference was held in that year at Paris.
The principalities were placed under a collective guarantee that was
to be enforced by the seven powers. Turkish suzerainty was affirmed,
but defined very narrowly: The Sultan was given the right to "invest
though not reject" the princes of the principalities (though the
meaning of this phrase was not particularly clear)...princes were to
be chosen for life by assemblies in each of the principalities.
Wallachia and Moldavia were declared autonomous in their internal
affairs. Some measure of government contact between the two
principalities was provided for, but full union was ruled out...
In 1859, the assemblies of Wallachia and Moldavia elected princes.
Much to the surprise of the seven powers, the boieri [nobles, big land owners], secure in their
control of the situation, had been won over to the nationalist cause,
and both assemblies elected the same prince, Ioan Cuza. By this act
the two principalities were united, and in 1861 they were formally
joined into a new Romanian state (which was, however, still
theoretically subject to the Ottoman Empire). Faced by this Romanian
action which was supported by Napoleon III, the powers accepted it.
This event anticipates up to a point the one discussed in the accepted answer (on Ibn Saud), which is more recent, but this has the advantage of referring to previously existent states, not newly created by the unifying ruler.