Stephen and his twin brother, Ladislaus, were sons of the Hungarian king Coloman by his wife, Felicia of Sicily. According to the Illuminated Chronicle, they were born "... in the year of our Lord 1101." Stephen was named after the first king of Hungary, who had been canonized in 1083, implying that he was his father's heir from birth. A document written in Zadar in approximately 1105 AD makes mention of "Stephen, our most renowned king" along with Coloman, proving that the latter had his four-year-old son crowned king.
By the time of Stephen's coronation, Coloman had demonstrated his intention to secure the succession for his son. Coloman's ambitious brother, Álmos — who had already rebelled against the king in 1098 — opposed this plan and left Hungary. He first sought the assistance of Henry V, Holy Roman Emperor, followed by an appeal to Duke Boleslaw III of Poland. When all of his efforts ended in failure, Álmos submitted to Coloman and returned to Hungary, although he made several abortive attempts to dethrone Coloman in the following decade. In order to bring an end to the menace these plots presented to Stephen's succession, Coloman had Álmos and Álmos's little son, Béla, blinded.
When he fell gravely ill in early 1116, Coloman also had his brother imprisoned. The Illuminated Chronicle narrates that the dying king "instructed his son and his great men" to invade Rus' in order to take vengeance for Coloman's failure in the 1099 siege of Peremyshl (Przemyśl), Poland. Coloman died on 3 February 1116.
Stephen was crowned king by Archbishop Lawrence of Esztergom in Székesfehérvár within thirty days of his father's death. His peaceful succession showed the effectiveness of the measures Coloman had implemented to prevent Álmos from usurping the throne. Upon his councilor’s advice, Stephen initiated a meeting with Vladislaus I, Duke of Bohemia, in order to improve the countries' relations, which had deteriorated in the previous decade. The two monarchs met on the river Olšava, which marked the border of their realms. However, the lack of mutual confidence hindered the opening of negotiations, leading to armed conflicts which evolved into a battle on 13 May. On the battlefield, the Bohemian army inflicted a serious defeat on Stephen's troops. The contemporaneous Cosmas of Prague blamed the young king's advisors for the fiasco, but later medieval Hungarian chronicles — all completed under kings descending from Stephen's opponent, Álmos — wrote that the king acted without consulting his advisors "... for he was of an impetuous nature".
The Hungarian people are prodigious in energy, mighty in strength, and very powerful in military arms—sufficient to fight with a king of lands anywhere. After the death of their king, Coloman, their princes sent to Duke Vladislav to renew and confirm with the new king, named Stephen, their ancient peace and friendship. ... Vladislav came to the River Olšava, which separates the realms of Hungary and Moravia. Immediately, the Hungarian people, innumerable as the sands or drops of rain, covered the whole surface of the land in the field of Lučsko, like locusts. ... But, as scripture says, "Woe to the land whose king is a child." Their princes, through their inborn pride in themselves, strayed from the duke's peaceful words and sent replies more to stir up strife than to bring the kiss of peace.