Inversion chords serve mutiple functions in the harmonic workings of a Bach chorale. First and foremost, they allow you to keep the bassline conjunct and smooth, whilst also making the harmonic progression functional. If you didnt use inversion chords in your chorale, the progression would be entirely dictated by the movement of the baseline, and any functional progressions would only be achieved by the bassline leaping to and from different root notes. Another key function of the inversion chord is to keep the harmonic language interesting. Repeated root position chords are permitted, however often the most musically satisfying answer to a harmonisiton will use a mixture of root position and inversion chords. It must be noted that second inversion chords are only permitted in a Ic - V - I cadence.
Inversions also play a role in certain cadential techniques, for example the iib - V7 - I cadence which is often used in Bach's chorales. The inverted ii chord is essential here because it gives the bassline a smoother approach onto the dominant chord (a single step rather than the leap of a 4th if the ii chord were simply in root position).