Why did God strike an infant with disease for 7 days until it died?
I don't know. However, I trust that the eternal God will make everything right in the end from the eternal point of view.
God, in his wisdom, has put people to death -- for example Uzzah when he touched the Ark of the Covenent. But it does feel different when it is a baby and not a sinful adult.
My personal belief is that human life was viewed differently in the past. In modern thinking, a baby has the full rights, legal protections and value as an adult. In fact, I suspect a legal settlement where an infant suffered a loss of limb in an accident, the settlement cost would be determined for the number of years the infant (soon to grow up) would have to deal with the injury. But an 90 yr old man similarly injured might be given
less settlement.
But in the Mosaic law, a fight that led to the miscarriage of a pregnant woman (and the death of the unborn) would result in just a monetary fine. But actions that lead to the death of an adult were typically considered a capital crime, punishable by the death penalty. Thus the societal value of adult life was much higher than that of an infant. If a person can be compared to a tree, then a seedling first bursting up from the ground has the
potential to provide nourishing food, but it is not the same as a fully-grown fruit tree ready for the harvest.
So David and Bathsheeba's infant, who had not had time to live and grow and develop, was not considered the same as a full-grown person. From the time David had Uriah killed, which was likely early in Bathseeba's pregnancy, the fetus was apparently judged by God to not be allowed to live. And what if the child had lived to grow up? Would it become king? And how would the circumstances of his birth affect his life's course? How would the entire nation be affected by this corruption at the very top of the government? So, instead, God stopped the infant's life, with it's near-zero societal value, to teach a stern lesson about how a should-be-righteous king can NOT be allowed to get away with murder. God gave them another son (Solomon), and richly blessed him. And in the age to come, who knows? Perhaps God will restore that baby to them and he will be allowed to grow up in a better world.
If the questions is why God caused the entire process to last 7 days, I would say that it gave time for David to demonstrate to all around him how the punishment was affecting him.
Just my 2 cents.
KT