Wearing hijab (Arabic for: Islamic-prescribed attire including a head covering) is an important religious requirement ordered by Almighty Allah in the Qur’an. As a Muslim lady, your first priority is to be obedient to your Creator. Prophet Muhammad (peace and blessings be upon him) said, “There is no obedience to anyone if it entails disobedience to Allah.” (Al-Tirmidhi)
In Islam, there are exceptions allowed for people in times of necessity. If you cannot get the passport except by complying to the aforementioned requirement and you are in a dire need of it, you may do so until such time that your condition improves, without incurring sin.
Dr.SalahSultan, a member of the European Council for Fatwa and Research, gave the following response on this,
If you really need the passport and there is no other option but to remove the hijab, you could take it off as an exceptional case. Put something like a wig to cover your hair and then take the passport photos.
Having said that, if you live in a country where such laws exist, it is your Islamic responsibility to work hard with human rights groups to claim your right in wearing the hijab. All countries have signed the agreement to respect the religious freedom of the individual, and hijab is part of your religious freedom. Therefore, you should struggle to ask for it.