Visiting graves to seek admonition and to make du`aa’ for the dead people is absolutely permissible. This is applicable when one visits graves of Muslim dead people, whether they are relatives — such as your mother-in-law — or not.
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states the following: Visiting graves is a sunnah of the Prophet (peace and blessings be upon him), as reported in the Hadith. The Prophet (peace and blessings be upon him) said, “I had forbidden you earlier from visiting graves, but now you can visit them, for it will remind you of the next world.”
Many scholars consider the above permission as being generally applicable to both males and females. Thus, according to them, just as men are allowed to visit the graves, women are also allowed to do so. This was the view of the Prophet’s wife `A’ishah (may Allah be pleased with her) as well as many others during the time of the Prophet and after him. But there are some others who object to women’s visiting of graves. They have relied on certain other reports attributed to the Prophet (peace and blessings be upon him) to the effect that the Prophet (peace and blessings be upon him) has cursed women who frequent graves for visitations.
there is no doubt that the people who forbid you from visiting graves are following the latter view. Their view, based on the above hadith, however, is not very strong, for, according to many scholars, the tradition they have cited is referring to those pagan women who used to practice wailing on the graves. This is different from someone visiting graves simply for the purpose of praying for the deceased. That is why even the Prophet’s wife `A’ishah (may Allah be pleased with her) visited the grave of her brother in Makkah when she came for Hajj. When asked if the Prophet (peace and blessings be upon him) hadn’t forbidden women from visiting graves, she replied, “That was in the beginning of Islam (when people were closer to paganism), later on he permitted it for both men and women.”
If, therefore, one is visiting the grave of their mother-in-law to pray for her soul, that is not at all considered as sinful; rather it is a meritorious act. This is perfectly justified in doing so following the ruling of the Mother of the Faithful `A’ishah as well as other reliable scholars and jurists.