This work describes the formation and possible electrochemical application of a novel nanocomposite based on single-walled carbon nanotubes (SWNTs) and imidazolium-based room-temperature ionic liquids (RTILs) of 1-butyl-3-methylimidazolium tetrafluoroborate ([bmim]BF4, a hydrophilic RTIL) and 1-butyl-3-methylimidazolium hexafluorophosphate ([bmim]PF6, a hydrophobic RTIL). The nanocomposites ([bmim]BF4-SWNTs, and [bmim]PF6-SWNTs) were formed by simply grinding the SWNTs with the respective RTIL. The results of the X-ray photoelectron spectroscopy (XPS) and Raman spectroscopy indicated that the nanocomposites were formed by adsorption of an imidazolium ion on the surface of SWNTs via the “cation–π” interaction. SEM images showed that [bmim]BF4-SWNTs (or [bmim]PF6-SWNTs) nanocomposites could uniformly cover the surface of a glassy carbon (GC) electrode resulting in a RTILs-SWNTs/GC modified electrode with a high stability. The RTILs-SWNTs composite could be readily used as a matrix to immobilize heme-containing proteins/enzymes (myoglobin, cytochrome c, and horseradish peroxidase) without undergoing denaturation, as was verified by UV–vis and circular dichroic (CD) spectroscopic results. The voltammetric results showed that heme-containing proteins/enzymes entrapped in RTILs-SWNTs composites displayed a pair of well-defined, stable redox peaks, which were ascribed to their direct electron-transfer reactions. The results of controlled experiments showed that the positive charged imidazolium ion played a significant effect on the electrochemical parameters, such as the redox peak separation and the value of the formal potentials, etc., of the electron-transfer reaction of non-neutral species dissolved in solution or immobilized on the electrode surface. Further results demonstrated that the heme-containing proteins/enzymes entrapped in RTILs-SWNTs composites could still retain their bioelectrocatalytic activity toward the reduction of oxygen and hydrogen peroxide. The results depicted in this work may pave a new avenue to electrocatalysis, proteins/enzymes electrochemistry, and bioelectrochemical synthesis, etc.