The mihrab, where the imam stands while leading people in the obligatory Prayers, did not exist during the time of Prophet Muhammad (peace and blessings be upon him) or in the first century of Islam. Rather, it appeared in the second century, and Muslims continued to construct it in mosques. The purpose of mihrabs was to show the person who enters the mosque the qiblah (direction of the Ka`bah). It continued to serve this aim and became a necessary part in the mosque.
Tackling this issue, Sheikh Ibn `Uthaymeen, a prominent scholar, said,
Scholars differed as to whether having a mihrab is sunnah, religiously desirable or permissible. I believe that having a mihrab is permissible, and this is the well-known view of our madh-hab (school of jurisprudence). However, the view that it is mustahabb (religiously desirable), because of the many benefits involved, such as showing the direction of the qiblah to those who do not know it, is a fair opinion.
Answering your question, the Standing Committee for Islamic Research and Ifta‘ stated,
Muslims have been constructing mihrabs in the front sections of their mosques since the time of the best centuries (the first three generations of Muslims) and afterward.
This is something of public benefit for Muslims. The mihrab is there to indicate the direction of the qiblah, and it also serves to identify the structure as being a mosque.