فَلَمَّا وَضَعَتْهَا قَالَتْ رَبِّ إِنِّي وَضَعْتُهَا أُنثَى وَاللّهُ أَعْلَمُ بِمَا وَضَعَتْ
Then when she gave birth to her, she said;"O my Lord! I have given birth to a female child, ـ and Allah knew better what she bore.
وَلَيْسَ الذَّكَرُ كَالاُنثَى
And the male is not like the female,
in strength and the commitment to worship Allah and serve the Masjid in Jerusalem.
وَإِنِّي سَمَّيْتُهَا مَرْيَمَ
And I have named her Maryam,
thus, testifying to the fact that it is allowed to give a name to the newly born the day it is born, as is apparent from the Ayah, which is also a part of the law of those who were before us.
Further, the Sunnah of the Messenger of Allah mentioned that the Prophet said,
وُلِدَ لِيَ اللَّيْلَةَ وَلَدٌ سَمَّيْتُهُ بِاسْمِ أَبِي إِبْرَاهِيم
This night, a son was born for me and I called him by my father's name, Ibrahim.
Al-Bukhari and Muslim collected this Hadith.
They also recorded that;
Anas bin Malik brought his newborn brother to the Messenger of Allah who chewed a piece of date and put it in the child's mouth and called him Abdullah.
Other new born infants were also given names on the day they were born.
Qatadah narrated that Al-Hasan Al-Basri said, that Samurah bin Jundub said that the Messenger of Allah said,
كُلُّ غُلَمٍ رَهِينٌ بِعَقِيقَتِهِ يُذْبَحُ عَنْهُ يَوْمَ سَابِعِهِ وَيُسَمَّى وَيُحْلَقُ رَأَسُه
Every new born boy held in security by his Aqiqah, until his seventh day, a sacrifice is offered on his behalf, he is given a name, and the hair on his head is shaved.
This Hadith was collected by Ahmad and the collectors of the Sunan, and was graded Sahih by At-Tirmidhi.
We should mention that another narration for this Hadith contained the wording, "and blood is offered on his behalf," which is more famous and established than the former narration, and Allah knows best.
Allah's statement that Maryam's mother said,
وِإِنِّي أُعِيذُهَا بِكَ وَذُرِّيَّتَهَا مِنَ الشَّيْطَانِ الرَّجِيمِ
"...And I seek refuge with You for her and for her offspring from Shaytan, the outcast."
means, that she sought refuge with Allah from the evil of Shaytan, for her and her offspring, i.e., `Isa, peace be upon him.
Allah accepted her supplication, for Abdur-Razzaq recorded that Abu Hurayrah said that the Messenger of Allah said,
مَا مِنْ مَوْلُودٍ يُولَدُ إِلاَّ مَسَّهُ الشَّيْطَانُ حِينَ يُولَدُ فَيَسْتَهِلُّ صَارِخًا مِنْ مَسِّهِ إِيَّاهُ إِلاَّ مَرْيَمَ وَابْنَهَا
Every newly born baby is touched by Shaytan when it is born, and the baby starts crying because of this touch, except Maryam and her son.
Abu Hurayrah then said,
"Read if you will,
وِإِنِّي أُعِيذُهَا بِكَ وَذُرِّيَّتَهَا مِنَ الشَّيْطَانِ الرَّجِيمِ
(And I seek refuge with You for her and for her offspring from Shaytan, the outcast)."
The Two Sahihs recorded this Hadith