Can mac receive messages when iCloud keeps asking for password?
If there was a problem with your iCloud account, and it was requesting your password, no, they shouldn't be able to read your messages.

However, to be sure, I would check with the current owner.

Always follow this guide before giving away your Mac.