All mammalian animals can sense height to some degree. This results from innate depth perception and learned experience throughout life. Young animals are less likely to be careful or aware of the dangers of height.
When bringing home a new kitten, you should always take steps to help them explore their new environment safely while they learn the necessary skills for keeping themselves out of trouble.