When the fasting of Ramadan was prescribed, the people would not approach their wives for the whole of Ramadan, yet some men were betraying themselves in this. So Allah revealed, "Allah knows that you were deceiving yourselves, so He turned to you in forgiveness and pardoned you" [Baqarah 2:187].
لما نزل صوم رمضان كانوا لا يقربون النساء رمضان كله، وكان رجال يخونون أنفسهم فأنزل الله: {علم الله أنكم كنتم تختانون أنفسكم فتاب عليكم وعفا عنكم}