Psalm 51:5 is clear. Regarding those who are so vexed by the text that they must accuse David's mother of sin, here are John Gill's words:
2. It is objected,that David here speaks not of his own, but of his mother’s sin, and a very broad intimation is given, that this was the sin of adultery; and, indeed, if he was conceived in a sin of his mother’s, what else could it be? This shows, that these men are grievously pinched with this text, and miserably put to their shifts, to betake themselves to such an interpretation, at the expense of the character of an innocent person, of whom there is not the least suggestion of this kind in the sacred writings; but on the contrary, she is represented as a religious person. David valued himself upon his being related to her, and pleads, that he might be regarded by the Lord for her sake (Ps. 86:16; 116:16). [b][u]Moreover, had this been the case, David must have been excluded from entrance into the congregation of the Lord; for there was a standing law (Deut. 23:2). in Israel, which forbade a bastard to enter there until the tenth generation; whereas it is certain, that David often went into the house of God with company, where he enjoyed much spiritual pleasure and delight (Ps. 43:4; 55:14; 122:1; Ps. 63:1, 2; Ps. 84:1, 10).[/u][/b] Once more, it is beside David’s scope and design to expose the sins of others, much less his own parents, whilst he is confessing and lamenting his own; and to what purpose should he mention theirs, especially if he himself was not affected by them, and did not derive corrupt nature from them? To say no more, the particle b, in, relates not to his mother, but to himself; it is not said, my mother in sin, that is, being in sin, or through sin, conceived me; but, my mother conceived me in sin, that is, as soon as I was conceived in the womb, and the mass of human nature was shaped and quickened; or as soon as soul and body were united together, sin was in me, and I was in sin, or became a sinful creature. Some, who do not run this length, yet say, that the sin and iniquity in which David was conceived and shapen, was the sinfulness of his parents, in the acts of begetting and conceiving him, though in lawful wedlock. But this cannot be true; since tire propagation of the human species, by natural generation, is a principle of nature implanted by God him-serf, and therefore cannot be sinful; and is agreeable to the first law of nature, given to man in a state of innocence, be fruitful and multiply. Marriage was instituted by God in paradise, and in all ages has been honorable in all, when the bed is undefiled. Besides, one of the words here used, translated shapen, is of the passive form, and designs something in which both David and his parents were entirely passive, and means no other than that amazing and surprising act of formation he so much admires in Psalm 139:13-16. Others interpret these words of his mother’s conceiving him [i]in profluviis[/i], which usually produces a body impure, ill tempered, and subject to evil passions. The Jews and Isidore are referred to for this sense of them, though the former, as far as I have been able to observe, say nothing of 2:14. Sol. Jarchi, R. David Kimchi, R. Aben Ezra, and R. Abendana, understand the words of the corruption of nature in man as soon as he is born. And as for Isidore, both elder and younger understand these words of original sin, in which David and all men are involved. However, nothing of this nature can be concluded from the sacred Scriptures concerning David, but rather the reverse; since he is taken notice of, as no other man is excepting Moses, for his being comely, ruddy, of a beautiful countenance, and goodly to look to (1 Sam. 16:12, 18); and so far from having an unclean body of an ill temperament, or subject to bad qualities.