FRANKFURT—On his first visit to Germany as India’s prime minister, Narendra Modi is slated as the guest of honor at the Hannover Messe—the world’s largest industrial trade fair—as he seeks to woo German investors to India.

But joining with German Chancellor Angela Merkel at the event on Monday, Mr. Modi will also be able to tout a spate of Indian mergers and acquisitions in Germany, particularly in the automotive, manufacturing, pharmaceuticals and information technology sectors.

Indian companies have mostly targeted Germany’s small and midsize firms—collectively known as the Mittelstand—often in the role of unexpected rescuer for the financially strapped.

Like many smaller German companies, railroad-tie maker Rail.One GmbH has a family history dating back more than a century. But when its heavily leveraged private-equity buyout went sour in 2011, the new owners sought an investor steeped in the rail business.

The best fit, executives decided, was PCM Group of Industries, an Indian conglomerate that had recently competed against Rail.One for contracts in Saudi Arabia. PCM in 2013 topped two other bidders for the German firm.