The Ben Ish Chai (Rabbi Yosef Chayim of Baghdad, 1833-1909), in his work Rav Pe'alim, addresses the issue of whether one would be permitted to ride a bicycle on Shabbat in the city of Baghdad. Baghdad was then encircled by a wall, and thus carrying was allowed inside the city on Shabbat. Accordingly, the Ben Ish Chai ruled that one may ride his bicycle in the streets of Baghdad on Shabbat.
However, Rabbi Yaakov Chayim Sofer (Baghdad-Israel, 1870-1939), in his work Kaf Ha'chayim (404), takes issue with the Ben Ish Chai's ruling, and indeed many other authorities concurred that riding bicycles is forbidden on Shabbat. We find several reasons given for this position. Firstly, some Rabbis were concerned that a tire or the chain might break and the person will forgetfully fix the bicycle, in violation of Shabbat. Additionally, a person riding a bicycle might unknowingly ride outside the Eruv or beyond the "Techum Shabbat" limit of 2,000 Amot (cubits) outside the city. Finally, many authorities deemed bicycle riding "Uvdin De'chol" workday activity, which is forbidden on Shabbat.
Chacham Ovadia Had'aya (Israel, 1890-1969), in his work "Yaskil Avdi," likewise forbids bicycle riding on Shabbat, and adds that he heard from reliable sources that the Ben Ish Chai himself retracted his position towards the end of his life, and forbade bicycle riding on Shabbat. There is, however, some controversy regarding this report. For one thing, Chacham Ovadia Had'aya himself does not specify the individuals who reported this information, and, furthermore, he introduces this report by writing, "It seems to me," suggesting some uncertainty in this regard. Additionally, the Ben Ish Chai published several works after the publication of Rav Pe'alim, begging the question of why he would not inform his readership of his retraction in one of his later works. What more, Rabbi Yaakov Chayim Sofer originated from Baghdad and would most likely have been aware of the Ben Ish Chai's position. Yet, he makes no mention of any change in the Ben Ish Chai's view towards the end of his life.
Rabbi Yaakov Segal of Hungary, in his work "She'eilat Yaakov" (published in 1918), wrote a responsum concerning a ruling issued by a Rabbi in his area permitting bicycle reading on Shabbat. Rabbi Segal sharply denounced this ruling, noting that only people lax in Halachic observance would ride a bicycle on Shabbat. He proceeds to express his sheer astonishment over the fact that a God-fearing Rabbi would issue a public ruling of this nature, and he makes reference in this context to the Gemara's comment in Masechet Pesachim that a scholar should not issue radical statements publicly, even if he deems them correct. He concludes his discussion with a prayer that the Almighty help that Rabbi perform Teshuva (repentance) for his ill-conceived ruling.
Chacham Ovadia Yosef addresses this issue in his work Leviyat Chen (107), and he writes that although we are not authorized to introduce new Gezeirot (enactments to safeguard against Torah violations), one should nevertheless refrain from bicycle riding on Shabbat. This is the position taken by leading Ashkenazic authorities, as well, including Rabbi Eliezer Waldenberg (contemporary scholar in Israel), in his work Tzitz Eliezer. As a high school student I asked Rabbi Yaakov Kassin for his opinion on this matter, and he likewise ruled definitively that bicycle riding is forbidden on Shabbat.
Summary: Although the Ben Ish Chai permitted bicycle riding on Shabbat, the vast majority of authorities disagreed and forbade riding bicycles on Shabbat, even in locations surrounded by a proper Eruv.