A 1796 publication titled A Classical Dictionary of the Vulgar Tongue by Francis Grose was a book of slang terms for the day and in it appeared the phrase bite the bullet.
Nightingale. A soldier who, as the term is, sings out at the halberts. It is a point of honour in some regiments, among the grenadiers, never to cry out, or become nightingales, whilst under the discipline of the cat of nine tails; to avoid which, they chew a bullet.
But there are other theories, perhaps ones you have heard before, and you can read about them here.
These days when we say bite the bullet we are saying that we or someone else needs to fortify self and prepare for the impending difficulty or pain that is coming.