Mata Kaulan was a women who was a free spirit and wanted to explore her surroundings. She had been adopted by a Muslim priest called Rustam Khan. He was based in Lahore, located in present-day Pakistan.
Qazi Rustam Khan had bought her from her parents while she was a child. It is possible that her parents were Hindus. The Qazi gave her the education of Islam and sent her to Saint Mian Mir for higher schooling.
Whenever the Guru visited Lahore, he never went back without seeing Saint Mian Mir. Due to these meetings, Saint Mian Mir knew a large number of Guru's verses by heart which he used to quote to his disciples.