Shragai was born into a Polish Orthodox Jewish family in Gorzkowice in 1899. He then became active in the religious Zionist movement and settled in Palestine in 1924, already playing an important political role before Israel's founding in 1948. In 1950, he was elected mayor of Jerusalem, a position he held for two years. He then became the head of immigration of the Jewish Agency for Palestine. This was a time of extensive immigration to Israel from Muslim countries, so he often went on clandestine trips to these countries to obtain the release of the Jews living there.