Praise be to Allah.
Allaah says (interpretation of the meaning):
“So set you (O Muhammad) your face towards the religion (of pure Islamic Monotheism) Haneef (worship none but Allaah Alone). Allaah’s Fitrah (i.e. Allaah’s Islamic Monotheism) with which He has created mankind. No change let there be in Khalq‑illaah (i.e. the religion of Allaah Islamic Monotheism), that is the straight religion, but most of men know not” [al-Room 30:30]
It was narrated from Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Every child is born in a state of fitrah (the natural state of man, i.e., Islam), then his parents make him into a Jew or a Christian or a Magian.” (Agreed upon).
The correct view is that what is meant by fitrah is the religion of Islam, as stated in the hadeeth narrated by Muslim from the Messenger of Allaah (peace and blessings of Allaah be upon him), who said: “Allaah said: ‘I created My slaves as haneefs (believers in pure monotheism), then the Shaytaan misled them from their religion; he forbade them what I had permitted to them and commanded them to associate others with Me for which I had not sent down any authority.’” What it means when it is said that a child is born as a Muslim is that he is born inherently ready, when he reaches the age of discretion, if he is given the choice between Islam and its opposite, to prefer Islam over its opposite and to choose Islam as his religion, so long as there is nothing to prevent him from doing so, such as his whims and desires or tribalism. Following his desires makes him prefer falsehood so that he may attain some share of leadership or wealth, and tribalism or racial pride makes him follow his forefathers or elders, even if they are not following true guidance. Allaah says (interpretation of the meaning):
“Nay! They say: ‘We found our fathers following a certain way and religion, and we guide ourselves by their footsteps’” [al-Zukhruf 43:23]
And Allaah tells us what the followers among the people of Hell will say (interpretation of the meaning):
“And they will say: ‘Our Lord! Verily, we obeyed our chiefs and our great ones, and they misled us from the (Right) Way’” [al-Ahzaab 33:67]
If every child is born in a state of fitrah, then obviously there will be some who will be influenced in ways that are in accordance with that fitrah and will strengthen it, such as those who are born to Muslim parents and grow up in a Muslim society. And there will be some whose fitrah is changed, such as those who are born to kaafir parents and group up among the kuffaar, be they Jews, Christians, Magians or mushrikeen. Undoubtedly the one who is born in Islam has means of guidance and happiness which are not available to others who are born and grow up in kaafir societies. Being given easy access to the means of faith and guidance is a blessing from Allaah which He gives to whomsoever He wills. It should also be noted that the person whose fitrah has been changed from Islam will not be punished for the sins of another; rather he will be punished if the call of the Messenger (peace and blessings of Allaah be upon him) reaches him and he does not accept it out of stubbornness, arrogance or tribalistic pride in the religion of his forefathers and countrymen, because proof is established against him when the call of the Messenger reaches him, and in such a case, if he persists in his kufr then he deserves to be punished. Allaah says (interpretation of the meaning):
“And We never punish until We have sent a Messenger (to give warning)” [al-Israa’ 17:15]
What you say in your question, “It scares me to think…”, is correct and is wise, for it is the blessing of Allaah upon you that you were born in Islam. If you had been born into another religion, there would have been the fear that you might remain in that false religion, but when Allaah wills good for His slave, He makes it easy for him to have the means of guidance which will bring him from the religion of kufr to the religion of Islam. The entire matter is up to Allaah.
But when you say in your question, “So why is it not the law that…?” this is a false question caused by unawareness of the wisdom of Allaah and His ways of dealing with His creation. Of course it is impossible for the same opportunities to be available to all, because there are so many different human religions, and guidance to Islam happens when a person chooses to be guided, because Allaah has given man the ability to distinguish between truth and falsehood, between what is beneficial and what is harmful, by means of the reason that He has instilled in him, and the explanations with which He has sent His Messengers. At the same time, the will of the person is subject to the will of Allaah, for He is the One Who sends astray whomsoever He wills by His justice and wisdom, and He guides whomsoever He will by His grace and wisdom.
Allaah says (interpretation of the meaning):
“Verily, this (the Qur’aan) is no less than a Reminder to (all) the ‘Aalameen (mankind and jinn)
To whomsoever among you who wills to walk straight.
And you cannot will unless (it be) that Allaah wills the Lord of the ‘Aalameen (mankind, jinn and all that exists)”[al-Takweer 81:27-29]