Ståhlberg was born in Suomussalmi in Finland. He was christened Carl Johan, which he later changed to Finnish form like most fennomans (supporters of Finnish language and culture). In Oulu Finnish lycee he was the primus of his class. In 1889 he graduated in Laws, as a Bachelor of Arts. He had a long career as the presenter and planner of the Senate's legislation already when Finland was a Russian Grand Duchy. He supported constitutional legislative policies, including legislative resistance, against the attempted Russification of Finland, eventually even women's suffrage, and had a moderate line on Prohibition.
In the beginning of Finland's independence he became the chairman of the Constitutional Council. They formed the first Constitution for Finland as an independent state. He tried to establish relations with Britain. In 1918 Ståhlberg supported the idea of republic instead of the then-popular constitutional monarchy – the idea collapsed after elected king Väinö I of Finland declined. Stålberg also championed direct presidential elections, but the Senate chose the elector-system.
The Senate elected Ståhlberg president on July 27, 1919. As a president he was formal and due to his shyness, wrote beforehand everything he had to say in public. He was a widower but remarried in 1920. He had to form various parliamentarian precedents and interpretations and nominate many short-lived cabinets. In foreign policy Ståhlberg was markedly reserved towards Sweden, cautious towards Germany, and generally unsuccessful in his attempts to closer contacts with Poland, the United Kingdom and France.
Ståhlberg did not seek re-election 1925. He became a senior member of the government's Judicial Council.
In 1930 activists from the right-wing Lapua Movement kidnapped him and his wife, attempting to send them to the Soviet Union, but the incident merely hastened the Lapua Movement's demise. He was a presidential candidate in 1931 and 1937 but was not elected. 1930-1932 he was Member of Parliament for the Nationalist Liberal Kansallinen Edistyspuolue party, fighting right-wing anti-parliamentarian initiatives.