Heap allocation is a memory management technique where memory is dynamically allocated from a pool known as the heap, allowing for flexible and efficient use of memory during a program's runtime. It contrasts with stack allocation, providing more control over the lifetime and size of data structures but requiring explicit management to prevent memory leaks and fragmentation.