Bangladesh has a population of 163 million. It has about 205,000 active duty soldiers and spends $4 billion USD which is 1.1% of its GDP on the military. Its only land borders are with India and Myanmar, although it also had Indian ocean ports. Bangladesh does not have nuclear weapons.
India has a population of 1,366 million. It has about 1,456,000 active duty soldiers and spends $67 billion which is 2.4% of its GDP on the military. India has nuclear weapons. India has active low level military hostilities with Pakistan and China, and also borders Sri Lanka, Nepal, Bhutan, Bangladesh and Myanmar.
The true relationship is not linear
This answer essentially says that the size of the military is related
to the population size and the GDP.
As a first order approximation that's a decent rule of thumb. But the relationship isn't truly linear. Soldiers per capita and spending as a percentage of GDP are measures of how militarily mobilized a country is, i.e. how hard it is trying to be militarily strong.
But how hard a country tries to be militarily strong depends upon a case by case analysis of plausible scenarios, which tend to allow big countries to mobilize less intensely while requiring small countries to mobilize more intensely than a linear relationships would suggest.
A country rationally devotes resources to the military until it is big enough to defeat its plausible opponents, or prevent its plausible opponents from starting a fight with it because it is too costly for them to do so. The goal in defending against an attack is to discourage this by making it expensive and ineffectual to use force, even if it is not possible to win a conflict against a sufficiently determined opponent.
If you are a country with more than a hundred and sixty million people, and all of your neighbors but one have much smaller populations and economies, like Bangladesh, and you don't have a foreign policy objective of pro-actively leading expeditionary military actions like the United States does, then any military sufficient to discourage India from invading you or blocking your ability to participate in international commerce is big enough, because any military big enough to do that is also more than big enough to, for example, ward off attacks from Myanmar or Sri Lanka on your seaports. The world's biggest mountain range and the military of India keeps China from invading you.
India won't invade, and Bangladesh would lose if it did
Also, if you are Bangladesh, you know that India has no serious intention of invading you to conquer your country, because back in the 1940s, India was partitioned to kick you out of it because India learned that having large Muslim majority populations under its majority Hindu national government created an untenable and ungovernable situation and the logic behind partition hasn't changed in the meantime.
So, your military only has to be big enough to discourage gratuitous raids into your territory without your consent for purposes other than conquest. If your military is big enough to do that, you don't have to spend more to accomplish that end, and as a poor developing country, you have lots of other pressing demands on your national budget.
While surely there are tensions and skirmishes through proxy insurgent type forces, those are asymmetric conflicts that are less expensive to deal with than an full on near peer conventional war between the two countries that are economically interdependent even if this leads to conflicts sometimes. Basically, the existing disputes can be summed up by saying that Bangladesh is being bullied by India in ways less extreme than a conventional military invasion.
But if you are Bangladesh, preparing for an all out near peer conventional war with India is folly. Even if you devote seven times more soldiers per capita to your military, and sixteen times as high a percentage of your GDP to your military (which would require Bangladesh to become as militarized a society as Israel or North Korea), Bangladesh would still lose, because India is so much bigger in the sheer size of its population and economy. And, in any such war, India would have a much easier time securing international allies in a fight with Bangladesh than Bangladesh, which can't even count Pakistan as a reliable ally in a near peer war with India.
Of course, if Bangladesh did, against all odds win in a conventional war with India, it would risk being nuked by India, an attack it could do nothing to defend itself against, or retaliate against, even with a profoundly greater level of military mobilization.
If any plausible amount of mobilization that Bangladesh could make to prepare for that potential conflict would have the same result, it doesn't make sense to spend the extra funds to prepare for it. The only way Bangladesh can win the game of a full fledged war with India is by not playing.
If rhetoric in India changed, and it showed an interest in invading and conquering Bangladesh, no doubt it would respond by increasing the size of its military and its military budget and seeking out military alliances and by stepping up its efforts to secure nuclear weapons. This is what Israel does. But Israel has many neighbors who have a policy of pushing it into the sea and obliterating it (who have tried to do so militarily more than once in the past), Bangladesh, doesn't.
In the meantime, spending excess amounts of money on a function of government that has already achieved its goals with less spending doesn't make much sense.
It is easier for leaders in a smaller military to organize a coup
Also, the military itself may not be lobbying hard for a larger military. And, it is particularly hard to mobilize politicians to create a larger military when the military itself tells the government that it doesn't urgently need to be bigger.
Why would this happen?
Empirically, it has proven to be easier for the leadership of a smaller military to organize a coup to keep civilian politicians in line with its vision for the nation. The military in Bangladesh is well aware of this fact because it has done so in the past in Bangladesh.
If the military gets to big, it increases the risk that its ability to carry out a coup when it deems it necessary to do so might be thwarted by another faction within the military itself.