Origin of the 40 Days
Chazal (our Sages) have long spoken about the Segula of praying for 40 consecutive days. Whether one recites shir hashirim (King Solomon's Song of Songs), tehillim (King David's psalms) or personal heart-felt words, 40 days is a significant time period to arouse G-d's mercy.
Praying for 40 consecutive days specifically at the Kotel (Western Wall) is a famous practice of Jews in Jerusalem. Most people have heard about the popular Segula through word-of-mouth and have made the pilgrimage for marriage partners, income, children, healing and other.
According to Rav Sheinberger, author of a popular commentary on the Zohar (the definitive book of Kabbalah), the Segula was officially coined by Rabbi Yisroel Yaakov Fisher, of blessed memory - one of the leading Sages of the last generation. Dayan Fischer reportedly said that if someone goes to the Western Wall for 40 consecutive days to pray for 1 thing, it was a special Segula of its own.
Dayan Fischer zt"l