Well, to start with, nothing so far as the instrument itself is concerned. The problems (and there are many) have to do with the people affiliated with the organ — at least since the second half of the twentieth century. And what do I mean by that? The organist asks indignantly. Let's take a look and see what happened.
During most of its long and glorious history the organ was always considered the supreme instrument of Western music. The fact that it is the oldest keyboard instrument, therefore the most complex mechanically, gave it a cache that no other instrument had, or has to this day. No other single instrument was capable of duplicating or exceeding the multi-voiced textures of a vocal ensemble than the organ: This capability in turn, helped pave the way to the development of the polyphonic complexities unique to Western music. It wasn't until the development of the 18th Century instrumental ensemble which became the foundation of our modern symphonic orchestra that the organ finally encountered any competition in this area. Even then, as now, the orchestra does not have the frequency range nor, in the case of a comparably sized organ, the dynamic range.
Moreover, up through the first decade of the Twentieth Century the organ was an immensely popular instrument. Most of the great composers before or since Bach have at least dabbled with the instrument. Mendelssohn was a virtuoso and wrote extensively for it, Brahms wrote for the instrument early in his career and then found consolation in it at the very end of his life. Mozart loved the organ as did Liszt who wrote a number of substantial pieces for it. Even Beethoven wrote a few, albeit inconsequential, pieces. Although in the 19th Century the piano became the more popular instrument primarily out of convenience, it was the to organ recitals that people flocked to hear transcriptions of their favourite orchestral works and the great works J. S. Bach.